Search in sources :

Example 6 with ColumnProjection

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

the class PhysicalReferenceExtractorTest method testPhysicalReference.

@Test
public void testPhysicalReference() {
    ColumnProjection recordedDate = playerStats.getColumnProjection("recordedDate");
    List<Reference> references = parser.parse(playerStats, recordedDate.getExpression());
    assertTrue(references.size() == 1);
    ReferenceExtractor<PhysicalReference> extractor = new ReferenceExtractor(PhysicalReference.class, metaDataStore, ReferenceExtractor.Mode.SAME_QUERY);
    Set<PhysicalReference> physicalReferences = references.get(0).accept(extractor);
    assertTrue(physicalReferences.size() == 1);
    assertTrue(physicalReferences.contains(PhysicalReference.builder().source(playerStats).name("recordedDate").build()));
}
Also used : ColumnProjection(com.yahoo.elide.datastores.aggregation.query.ColumnProjection) Test(org.junit.jupiter.api.Test)

Example 7 with ColumnProjection

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

the class ExpressionParserTest method testJoinExpression.

@Test
public void testJoinExpression() {
    ColumnProjection countryInUsa = playerStats.getColumnProjection("countryIsInUsa");
    List<Reference> references = parser.parse(playerStats, countryInUsa.getExpression());
    assertTrue(references.size() == 1);
    assertEquals(countryInUSAJoinReference, references.get(0));
}
Also used : ColumnProjection(com.yahoo.elide.datastores.aggregation.query.ColumnProjection) Test(org.junit.jupiter.api.Test)

Example 8 with ColumnProjection

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

the class HasColumnArgsVisitorTest method testSimpleJoinToLogicalColumn.

@Test
public void testSimpleJoinToLogicalColumn() throws Exception {
    SQLTable table = metaDataStore.getTable(ClassType.of(TableC.class));
    ColumnProjection projection = table.getColumnProjection("simpleJoinToLogical");
    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)

Example 9 with ColumnProjection

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

the class HasColumnArgsVisitorTest method testJoinWithLogicalReferenceThatReferencesColumnArgs.

@Test
public void testJoinWithLogicalReferenceThatReferencesColumnArgs() throws Exception {
    SQLTable table = metaDataStore.getTable(ClassType.of(TableC.class));
    ColumnProjection projection = table.getColumnProjection("joinWithLogicalWithColumnArgsToPhysical");
    assertTrue(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)

Example 10 with ColumnProjection

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

the class HasColumnArgsVisitorTest method testNestedJoinWithColumnArgs.

@Test
public void testNestedJoinWithColumnArgs() throws Exception {
    SQLTable table = metaDataStore.getTable(ClassType.of(TableC.class));
    ColumnProjection projection = table.getColumnProjection("nestedJoinWithColumnArgs");
    assertTrue(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