Search in sources :

Example 1 with PartitionExpression

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

the class HiveParserBaseSemanticAnalyzer method processPartitionSpec.

static PartitionSpec processPartitionSpec(HiveParserASTNode node) {
    PartitionSpec pSpec = new PartitionSpec();
    int exprCnt = node.getChildCount();
    for (int i = 0; i < exprCnt; i++) {
        PartitionExpression exprSpec = new PartitionExpression();
        exprSpec.setExpression((HiveParserASTNode) node.getChild(i));
        pSpec.addExpression(exprSpec);
    }
    return pSpec;
}
Also used : PartitionExpression(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionExpression) PartitionSpec(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionSpec)

Example 2 with PartitionExpression

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

the class HiveParserBaseSemanticAnalyzer method getPartitionKeys.

public static List<RexNode> getPartitionKeys(PartitionSpec partitionSpec, HiveParserRexNodeConverter converter, HiveParserRowResolver inputRR, HiveParserTypeCheckCtx typeCheckCtx, HiveParserSemanticAnalyzer semanticAnalyzer) throws SemanticException {
    List<RexNode> res = new ArrayList<>();
    if (partitionSpec != null) {
        List<PartitionExpression> expressions = partitionSpec.getExpressions();
        for (PartitionExpression expression : expressions) {
            typeCheckCtx.setAllowStatefulFunctions(true);
            ExprNodeDesc exp = semanticAnalyzer.genExprNodeDesc(expression.getExpression(), inputRR, typeCheckCtx);
            res.add(converter.convert(exp));
        }
    }
    return res;
}
Also used : PartitionExpression(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionExpression) ArrayList(java.util.ArrayList) ExprNodeDesc(org.apache.hadoop.hive.ql.plan.ExprNodeDesc) RexNode(org.apache.calcite.rex.RexNode)

Example 3 with PartitionExpression

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

the class HiveParserWindowingSpec method applyConstantPartition.

private void applyConstantPartition(WindowSpec wdwSpec) {
    PartitionSpec partSpec = wdwSpec.getPartition();
    if (partSpec == null) {
        partSpec = new PartitionSpec();
        PartitionExpression partExpr = new PartitionExpression();
        partExpr.setExpression(new HiveParserASTNode(new CommonToken(HiveASTParser.Number, "0")));
        partSpec.addExpression(partExpr);
        wdwSpec.setPartition(partSpec);
    }
}
Also used : PartitionExpression(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionExpression) CommonToken(org.antlr.runtime.CommonToken) PartitionSpec(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionSpec)

Aggregations

PartitionExpression (org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionExpression)3 PartitionSpec (org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionSpec)2 ArrayList (java.util.ArrayList)1 CommonToken (org.antlr.runtime.CommonToken)1 RexNode (org.apache.calcite.rex.RexNode)1 ExprNodeDesc (org.apache.hadoop.hive.ql.plan.ExprNodeDesc)1