Search in sources :

Example 1 with PTFInputSpec

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

the class HiveParserSemanticAnalyzer method processPTFSource.

// --------------------------- PTF handling -----------------------------------
/*
     * - a partitionTableFunctionSource can be a tableReference, a SubQuery or another
     *   PTF invocation.
     * - For a TABLEREF: set the source to the alias returned by processTable
     * - For a SubQuery: set the source to the alias returned by processSubQuery
     * - For a PTF invocation: recursively call processPTFChain.
     */
private PTFInputSpec processPTFSource(HiveParserQB qb, HiveParserASTNode inputNode) throws SemanticException {
    PTFInputSpec qInSpec = null;
    int type = inputNode.getType();
    String alias;
    switch(type) {
        case HiveASTParser.TOK_TABREF:
            alias = processTable(qb, inputNode);
            qInSpec = new PTFQueryInputSpec();
            ((PTFQueryInputSpec) qInSpec).setType(PTFQueryInputType.TABLE);
            ((PTFQueryInputSpec) qInSpec).setSource(alias);
            break;
        case HiveASTParser.TOK_SUBQUERY:
            alias = processSubQuery(qb, inputNode);
            qInSpec = new PTFQueryInputSpec();
            ((PTFQueryInputSpec) qInSpec).setType(PTFQueryInputType.SUBQUERY);
            ((PTFQueryInputSpec) qInSpec).setSource(alias);
            break;
        case HiveASTParser.TOK_PTBLFUNCTION:
            qInSpec = processPTFChain(qb, inputNode);
            break;
        default:
            throw new SemanticException(HiveParserUtils.generateErrorMessage(inputNode, "Unknown input type to PTF"));
    }
    qInSpec.setAstNode(inputNode);
    return qInSpec;
}
Also used : PTFInputSpec(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PTFInputSpec) HiveParserBaseSemanticAnalyzer.unescapeSQLString(org.apache.flink.table.planner.delegation.hive.copy.HiveParserBaseSemanticAnalyzer.unescapeSQLString) PTFQueryInputSpec(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PTFQueryInputSpec) SemanticException(org.apache.hadoop.hive.ql.parse.SemanticException)

Aggregations

HiveParserBaseSemanticAnalyzer.unescapeSQLString (org.apache.flink.table.planner.delegation.hive.copy.HiveParserBaseSemanticAnalyzer.unescapeSQLString)1 PTFInputSpec (org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PTFInputSpec)1 PTFQueryInputSpec (org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PTFQueryInputSpec)1 SemanticException (org.apache.hadoop.hive.ql.parse.SemanticException)1