Search in sources :

Example 21 with ColumnProjection

use of com.yahoo.elide.datastores.aggregation.query.ColumnProjection in project elide by yahoo.

the class SQLColumnProjectionTest method testPhysicalColumnThatCanNest.

@Test
public void testPhysicalColumnThatCanNest() throws Exception {
    SQLTable table = metaDataStore.getTable(ClassType.of(TableB.class));
    ColumnProjection projection = table.getColumnProjection("dim1");
    assertTrue(projection.canNest(table, metaDataStore));
}
Also used : SQLTable(com.yahoo.elide.datastores.aggregation.queryengines.sql.metadata.SQLTable) ColumnProjection(com.yahoo.elide.datastores.aggregation.query.ColumnProjection) Test(org.junit.jupiter.api.Test)

Example 22 with ColumnProjection

use of com.yahoo.elide.datastores.aggregation.query.ColumnProjection in project elide by yahoo.

the class SQLColumnProjectionTest method testColumnArgsColumnThatCanNest.

@Test
public void testColumnArgsColumnThatCanNest() throws Exception {
    SQLTable table = metaDataStore.getTable(ClassType.of(TableA.class));
    Map<String, Argument> args = new HashMap<>();
    args.put("foo", Argument.builder().name("foo").value("bar").build());
    ColumnProjection projection = table.getColumnProjection("dim2", args);
    assertTrue(projection.canNest(table, metaDataStore));
}
Also used : Argument(com.yahoo.elide.core.request.Argument) HashMap(java.util.HashMap) SQLTable(com.yahoo.elide.datastores.aggregation.queryengines.sql.metadata.SQLTable) ColumnProjection(com.yahoo.elide.datastores.aggregation.query.ColumnProjection) Test(org.junit.jupiter.api.Test)

Example 23 with ColumnProjection

use of com.yahoo.elide.datastores.aggregation.query.ColumnProjection in project elide by yahoo.

the class ExpressionParserTest method testLogicalExpression.

@Test
public void testLogicalExpression() {
    ColumnProjection playerLevel = playerStats.getColumnProjection("playerLevel");
    List<Reference> references = parser.parse(playerStats, playerLevel.getExpression());
    assertTrue(references.size() == 1);
    assertEquals(LogicalReference.builder().source(playerStats).column(playerStats.getColumnProjection("overallRating")).reference(PhysicalReference.builder().source(playerStats).name("overallRating").build()).build(), references.get(0));
}
Also used : ColumnProjection(com.yahoo.elide.datastores.aggregation.query.ColumnProjection) Test(org.junit.jupiter.api.Test)

Example 24 with ColumnProjection

use of com.yahoo.elide.datastores.aggregation.query.ColumnProjection in project elide by yahoo.

the class ExpressionParserTest method testPhysicalExpression.

@Test
public void testPhysicalExpression() {
    ColumnProjection recordedDate = playerStats.getColumnProjection("recordedDate");
    List<Reference> references = parser.parse(playerStats, recordedDate.getExpression());
    assertTrue(references.size() == 1);
    assertEquals(PhysicalReference.builder().name("recordedDate").source(playerStats).build(), references.get(0));
}
Also used : ColumnProjection(com.yahoo.elide.datastores.aggregation.query.ColumnProjection) Test(org.junit.jupiter.api.Test)

Example 25 with ColumnProjection

use of com.yahoo.elide.datastores.aggregation.query.ColumnProjection in project elide by yahoo.

the class HasColumnArgsVisitorTest method testPhysicalColumn.

@Test
public void testPhysicalColumn() throws Exception {
    SQLTable table = metaDataStore.getTable(ClassType.of(TableB.class));
    ColumnProjection projection = table.getColumnProjection("physical");
    assertFalse(matches(table, projection));
}
Also used : SQLTable(com.yahoo.elide.datastores.aggregation.queryengines.sql.metadata.SQLTable) ColumnProjection(com.yahoo.elide.datastores.aggregation.query.ColumnProjection) Test(org.junit.jupiter.api.Test)

Aggregations

ColumnProjection (com.yahoo.elide.datastores.aggregation.query.ColumnProjection)36 Test (org.junit.jupiter.api.Test)22 SQLTable (com.yahoo.elide.datastores.aggregation.queryengines.sql.metadata.SQLTable)13 Argument (com.yahoo.elide.core.request.Argument)7 Queryable (com.yahoo.elide.datastores.aggregation.query.Queryable)6 Query (com.yahoo.elide.datastores.aggregation.query.Query)5 Argument.getArgumentMapFromString (com.yahoo.elide.core.request.Argument.getArgumentMapFromString)4 ValueType (com.yahoo.elide.datastores.aggregation.metadata.enums.ValueType)4 Column (com.yahoo.elide.datastores.aggregation.metadata.models.Column)4 ExpressionParser (com.yahoo.elide.datastores.aggregation.queryengines.sql.expression.ExpressionParser)4 List (java.util.List)4 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 Path (com.yahoo.elide.core.Path)3 FilterExpression (com.yahoo.elide.core.filter.expression.FilterExpression)3 MetaDataStore (com.yahoo.elide.datastores.aggregation.metadata.MetaDataStore)3 Reference (com.yahoo.elide.datastores.aggregation.queryengines.sql.expression.Reference)3 HashMap (java.util.HashMap)3 HandlebarsException (com.github.jknack.handlebars.HandlebarsException)2 EntityDictionary (com.yahoo.elide.core.dictionary.EntityDictionary)2