Search in sources :

Example 6 with ColumnAccessInfo

use of org.apache.hadoop.hive.ql.parse.ColumnAccessInfo in project flink by apache.

the class HiveParserCalcitePlanner method logicalPlan.

private RelNode logicalPlan() {
    if (semanticAnalyzer.columnAccessInfo == null) {
        semanticAnalyzer.columnAccessInfo = new ColumnAccessInfo();
    }
    subqueryId = 0;
    relToRowResolver.clear();
    relToHiveColNameCalcitePosMap.clear();
    try {
        RelNode plan = genLogicalPlan(getQB(), true, null, null);
        if (createViewInfo != null) {
            semanticAnalyzer.resultSchema = HiveParserUtils.convertRowSchemaToResultSetSchema(relToRowResolver.get(plan), false);
            HiveParserUtils.saveViewDefinition(semanticAnalyzer.resultSchema, createViewInfo, semanticAnalyzer.ctx.getTokenRewriteStream(), semanticAnalyzer.unparseTranslator, semanticAnalyzer.getConf());
        } else if (ctasCols != null) {
            // CTAS doesn't allow specifying col list, so we set it according to result schema
            semanticAnalyzer.resultSchema = HiveParserUtils.convertRowSchemaToResultSetSchema(relToRowResolver.get(plan), false);
            ctasCols.addAll(semanticAnalyzer.resultSchema);
        }
        return plan;
    } catch (SemanticException e) {
        throw new RuntimeException(e);
    }
}
Also used : RelNode(org.apache.calcite.rel.RelNode) ColumnAccessInfo(org.apache.hadoop.hive.ql.parse.ColumnAccessInfo) SemanticException(org.apache.hadoop.hive.ql.parse.SemanticException)

Aggregations

ColumnAccessInfo (org.apache.hadoop.hive.ql.parse.ColumnAccessInfo)6 Table (org.apache.hadoop.hive.ql.metadata.Table)4 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedHashSet (java.util.LinkedHashSet)2 RelOptTable (org.apache.calcite.plan.RelOptTable)2 RelNode (org.apache.calcite.rel.RelNode)2 RexNode (org.apache.calcite.rex.RexNode)2 ReadEntity (org.apache.hadoop.hive.ql.hooks.ReadEntity)2 ImmutableList (com.google.common.collect.ImmutableList)1 Iterables (com.google.common.collect.Iterables)1 Lists (com.google.common.collect.Lists)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Set (java.util.Set)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1