Search in sources :

Example 1 with PartitionSpec

use of org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionSpec 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 PartitionSpec

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

the class HiveParserBaseSemanticAnalyzer method processPTFPartitionSpec.

static PartitioningSpec processPTFPartitionSpec(HiveParserASTNode pSpecNode) {
    PartitioningSpec partitioning = new PartitioningSpec();
    HiveParserASTNode firstChild = (HiveParserASTNode) pSpecNode.getChild(0);
    int type = firstChild.getType();
    if (type == HiveASTParser.TOK_DISTRIBUTEBY || type == HiveASTParser.TOK_CLUSTERBY) {
        PartitionSpec pSpec = processPartitionSpec(firstChild);
        partitioning.setPartSpec(pSpec);
        HiveParserASTNode sortNode = pSpecNode.getChildCount() > 1 ? (HiveParserASTNode) pSpecNode.getChild(1) : null;
        if (sortNode != null) {
            OrderSpec oSpec = processOrderSpec(sortNode);
            partitioning.setOrderSpec(oSpec);
        }
    } else if (type == HiveASTParser.TOK_SORTBY || type == HiveASTParser.TOK_ORDERBY) {
        OrderSpec oSpec = processOrderSpec(firstChild);
        partitioning.setOrderSpec(oSpec);
    }
    return partitioning;
}
Also used : OrderSpec(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.OrderSpec) PartitionSpec(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionSpec) PartitioningSpec(org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitioningSpec)

Example 3 with PartitionSpec

use of org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionSpec 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

PartitionSpec (org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionSpec)3 PartitionExpression (org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitionExpression)2 CommonToken (org.antlr.runtime.CommonToken)1 OrderSpec (org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.OrderSpec)1 PartitioningSpec (org.apache.flink.table.planner.delegation.hive.copy.HiveParserPTFInvocationSpec.PartitioningSpec)1