Examples of PartitionExpression


Examples of com.cloudera.cdk.data.PartitionExpression

public class TestPartitionExpression {

  @Test
  public void testPartitionStrategy() {
    String expr = "hash(\"username\", \"username_part\", 2)";
    PartitionExpression expression = new PartitionExpression(expr, true);

    PartitionStrategy strategy = expression.evaluate();
    List<FieldPartitioner> fieldPartitioners = strategy.getFieldPartitioners();
    Assert.assertEquals(1, fieldPartitioners.size());
    FieldPartitioner fp = fieldPartitioners.get(0);
    Assert.assertEquals(HashFieldPartitioner.class, fp.getClass());
    Assert.assertEquals("username", fp.getSourceName());
View Full Code Here

Examples of com.cloudera.cdk.data.PartitionExpression

  @Test
  public void testSubpartitionStrategy() {
    String expr = "[hash(\"username\", \"username_part\", 2), hash(\"username2\", " +
        "\"username2_part\", 3)]";
    PartitionExpression expression = new PartitionExpression(expr, true);

    PartitionStrategy strategy = expression.evaluate();
    List<FieldPartitioner> fieldPartitioners = strategy.getFieldPartitioners();
    Assert.assertEquals(2, fieldPartitioners.size());

    FieldPartitioner fp0 = fieldPartitioners.get(0);
    Assert.assertEquals(HashFieldPartitioner.class, fp0.getClass());
View Full Code Here

Examples of com.cloudera.cdk.data.PartitionExpression

  }

  @Test
  public void testMixedSubpartitionStrategy() {
    String expr = "[year(\"timestamp\", \"year\"), minute(\"timestamp\", \"minute\")]";
    PartitionExpression expression = new PartitionExpression(expr, true);

    PartitionStrategy strategy = expression.evaluate();
    List<FieldPartitioner> fieldPartitioners = strategy.getFieldPartitioners();
    Assert.assertEquals(2, fieldPartitioners.size());

    FieldPartitioner fp0 = fieldPartitioners.get(0);
    Assert.assertEquals(YearFieldPartitioner.class, fp0.getClass());
View Full Code Here

Examples of io.crate.operation.reference.partitioned.PartitionExpression

    private PartitionReferenceResolver preparePartitionResolver(
            ReferenceResolver referenceResolver, List<ReferenceInfo> partitionColumns) {
        List<PartitionExpression> partitionExpressions = new ArrayList<>(partitionColumns.size());
        int idx = 0;
        for (ReferenceInfo partitionedByColumn : partitionColumns) {
            partitionExpressions.add(new PartitionExpression(partitionedByColumn, idx));
            idx++;
        }
        return new PartitionReferenceResolver(referenceResolver, partitionExpressions);
    }
View Full Code Here

Examples of io.crate.operation.reference.partitioned.PartitionExpression

        }
    }

    @Override
    public ReferenceImplementation getImplementation(ReferenceIdent ident) {
        PartitionExpression expression = expressionMap.get(ident);
        assert expression != null || fallbackResolver.getImplementation(ident) == null
                : "granularity < PARTITION should have been resolved already";
        return expression;
    }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionExpression

      return;
    }
    PTFInputSpec iSpec = spec.getInput();
    if (iSpec instanceof PTFInputSpec) {
      PartitionSpec partSpec = new PartitionSpec();
      PartitionExpression partExpr = new PartitionExpression();
      partExpr.setExpression(new ASTNode(new CommonToken(HiveParser.Number, "0")));
      partSpec.addExpression(partExpr);
      spec.setPartition(partSpec);
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionExpression

  private PartitionSpec processPartitionSpec(ASTNode node) {
    PartitionSpec pSpec = new PartitionSpec();
    int exprCnt = node.getChildCount();
    for(int i=0; i < exprCnt; i++) {
      PartitionExpression exprSpec = new PartitionExpression();
      exprSpec.setExpression((ASTNode) node.getChild(i));
      pSpec.addExpression(exprSpec);
    }
    return pSpec;
  }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionExpression

  private PartitionSpec processPartitionSpec(ASTNode node) {
    PartitionSpec pSpec = new PartitionSpec();
    int exprCnt = node.getChildCount();
    for(int i=0; i < exprCnt; i++) {
      PartitionExpression exprSpec = new PartitionExpression();
      exprSpec.setExpression((ASTNode) node.getChild(i));
      pSpec.addExpression(exprSpec);
    }
    return pSpec;
  }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionExpression

  private void applyContantPartition(WindowSpec wdwSpec) {
    PartitionSpec partSpec = wdwSpec.getPartition();
    if ( partSpec == null ) {
      partSpec = new PartitionSpec();
      PartitionExpression partExpr = new PartitionExpression();
      partExpr.setExpression(new ASTNode(new CommonToken(HiveParser.Number, "0")));
      partSpec.addExpression(partExpr);
      wdwSpec.setPartition(partSpec);
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionExpression

      return;
    }
    PTFInputSpec iSpec = spec.getInput();
    if (iSpec instanceof PTFInputSpec) {
      PartitionSpec partSpec = new PartitionSpec();
      PartitionExpression partExpr = new PartitionExpression();
      partExpr.setExpression(new ASTNode(new CommonToken(HiveParser.Number, "0")));
      partSpec.addExpression(partExpr);
      spec.setPartition(partSpec);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.