Search in sources :

Example 1 with HiveParserPreCboCtx

use of org.apache.flink.table.planner.delegation.hive.copy.HiveParserPreCboCtx in project flink by apache.

the class HiveParserCalcitePlanner method genLogicalPlan.

// Given an AST, generate and return the RelNode plan. Returns null if nothing needs to be done.
public RelNode genLogicalPlan(HiveParserASTNode ast) throws SemanticException {
    LOG.info("Starting generating logical plan");
    HiveParserPreCboCtx cboCtx = new HiveParserPreCboCtx();
    // change the location of position alias process here
    processPositionAlias(ast, semanticAnalyzer.getConf());
    if (!semanticAnalyzer.genResolvedParseTree(ast, cboCtx)) {
        return null;
    }
    // plan
    for (String alias : semanticAnalyzer.getQB().getSubqAliases()) {
        removeOBInSubQuery(semanticAnalyzer.getQB().getSubqForAlias(alias));
    }
    HiveParserASTNode queryForCbo = ast;
    if (cboCtx.type == HiveParserPreCboCtx.Type.CTAS || cboCtx.type == HiveParserPreCboCtx.Type.VIEW) {
        // nodeOfInterest is the query
        queryForCbo = cboCtx.nodeOfInterest;
    }
    verifyCanHandleAst(queryForCbo, getQB(), semanticAnalyzer.getQueryProperties());
    semanticAnalyzer.disableJoinMerge = true;
    return logicalPlan();
}
Also used : HiveParserASTNode(org.apache.flink.table.planner.delegation.hive.copy.HiveParserASTNode) HiveParserPreCboCtx(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPreCboCtx)

Aggregations

HiveParserASTNode (org.apache.flink.table.planner.delegation.hive.copy.HiveParserASTNode)1 HiveParserPreCboCtx (org.apache.flink.table.planner.delegation.hive.copy.HiveParserPreCboCtx)1