Search in sources :

Example 6 with RelColumnOrigin

use of org.apache.calcite.rel.metadata.RelColumnOrigin in project calcite by apache.

the class RelMetadataTest method checkTwoColumnOrigin.

// WARNING:  this requires the two table names to be different
private void checkTwoColumnOrigin(String sql, String expectedTableName1, String expectedColumnName1, String expectedTableName2, String expectedColumnName2, boolean expectedDerived) {
    Set<RelColumnOrigin> result = checkColumnOrigin(sql);
    assertTrue(result != null);
    assertEquals(2, result.size());
    for (RelColumnOrigin rco : result) {
        RelOptTable actualTable = rco.getOriginTable();
        List<String> actualTableName = actualTable.getQualifiedName();
        String actualUnqualifiedName = Iterables.getLast(actualTableName);
        if (actualUnqualifiedName.equals(expectedTableName1)) {
            checkColumnOrigin(rco, expectedTableName1, expectedColumnName1, expectedDerived);
        } else {
            checkColumnOrigin(rco, expectedTableName2, expectedColumnName2, expectedDerived);
        }
    }
}
Also used : RelColumnOrigin(org.apache.calcite.rel.metadata.RelColumnOrigin) RelOptTable(org.apache.calcite.plan.RelOptTable)

Aggregations

RelColumnOrigin (org.apache.calcite.rel.metadata.RelColumnOrigin)6 RelOptTable (org.apache.calcite.plan.RelOptTable)2 RelNode (org.apache.calcite.rel.RelNode)2 RelMetadataQuery (org.apache.calcite.rel.metadata.RelMetadataQuery)2 ImmutableList (com.google.common.collect.ImmutableList)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Aggregate (org.apache.calcite.rel.core.Aggregate)1 AggregateCall (org.apache.calcite.rel.core.AggregateCall)1 JoinInfo (org.apache.calcite.rel.core.JoinInfo)1 ImmutableBitSet (org.apache.calcite.util.ImmutableBitSet)1 IntPair (org.apache.calcite.util.mapping.IntPair)1 CalciteSemanticException (org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSemanticException)1 RelOptHiveTable (org.apache.hadoop.hive.ql.optimizer.calcite.RelOptHiveTable)1 HiveAggregate (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveAggregate)1 HiveRelNode (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveRelNode)1