Package org.kitesdk.data.spi.partition

Examples of org.kitesdk.data.spi.partition.HashFieldPartitioner


     * @param buckets
     *          The number of buckets into which data is to be partitioned.
     * @return An instance of the builder for method chaining.
     */
    public Builder hash(String sourceName, int buckets) {
      add(new HashFieldPartitioner(sourceName, buckets));
      return this;
    }
View Full Code Here


     *          The number of buckets into which data is to be partitioned.
     * @return An instance of the builder for method chaining.
     * @since 0.3.0
     */
    public Builder hash(String sourceName, @Nullable String name, int buckets) {
      add(new HashFieldPartitioner(sourceName, name, buckets));
      return this;
    }
View Full Code Here

        .requiredLong("created_at")
        .requiredString("color")
        .optionalInt("number")
        .endRecord();
    FieldPartitioner<Object, Integer> hash50 =
        new HashFieldPartitioner("name", 50);

    Constraints c = new Constraints(schema)
        .with("number", 7, 14, 21, 28, 35, 42, 49)
        .with("color", "green", "orange")
        .from("created_at",
            new DateTime(2013, 1, 1, 0, 0, DateTimeZone.UTC).getMillis())
        .toBefore("created_at",
            new DateTime(2014, 1, 1, 0, 0, DateTimeZone.UTC).getMillis());

    PartitionStrategy strategy = new PartitionStrategy.Builder()
        .hash("color", "hash", 50)
        .year("created_at").month("created_at").day("created_at")
        .identity("color")
        .build();

    StorageKey key = new StorageKey(strategy);

    key.replaceValues(Lists.<Object>newArrayList(
        hash50.apply("green"), 2013, 9, 1, "green"));
    Assert.assertEquals(Sets.newHashSet("number"),
        c.minimizeFor(key).keySet());

    // adjust the end time so that month is the last field checked
    Constraints c2 = c.toBefore("created_at",
View Full Code Here

TOP

Related Classes of org.kitesdk.data.spi.partition.HashFieldPartitioner

Copyright © 2018 www.massapicom. 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.