/** * Configure a partitioner for extracting the year from a timestamp field. * The UTC timezone is assumed. If name is null, the partition entity name * will be "year". * * @param sourceName * The entity field name from which to get values to be * partitioned. * @param name * The entity field name of the partition. * @return An instance of the builder for method chaining. * @since 0.3.0 */ public Builder year(String sourceName, @Nullable String name) { add(new YearFieldPartitioner(sourceName, name)); return this; }
/** * Configure a partitioner for extracting the minute from a timestamp field. * The UTC timezone is assumed. If name is null, the partition entity name * will be "minute". * * @param sourceName * The entity field name from which to get values to be * partitioned. * @param name * The entity field name of the partition. * @return An instance of the builder for method chaining. * @since 0.3.0 */ public Builder minute(String sourceName, @Nullable String name) { add(new MinuteFieldPartitioner(sourceName, name)); return this; }
/** * Configure a partitioner for extracting the month from a timestamp field. * The UTC timezone is assumed. If name is null, the partition entity name * will be "month". * * @param sourceName * The entity field name from which to get values to be * partitioned. * @param name * The entity field name of the partition. * @return An instance of the builder for method chaining. * @since 0.3.0 */ public Builder month(String sourceName, @Nullable String name) { add(new MonthFieldPartitioner(sourceName, name)); return this; }
/** * Configure a range partitioner with fixed-size ranges. A value <code>v</code> * is placed in the partition <code>floor(v/size)*size</code>. * * The partition name will be the source field name with a "_range" suffix. * For example, fixedSizeRange("number", 10) creates "number_range" * partitions. * * @param sourceName * The entity field name from which to get values to be * partitioned. * @param size * The size of the range. * @return An instance of the builder for method chaining. * @see IntRangeFieldPartitioner * @since 1.1.0 */ public Builder fixedSizeRange(String sourceName, long size) { add(new LongFixedSizeRangeFieldPartitioner(sourceName, size)); return this; }
/** * Configure a partitioner that uses values always provided at runtime. * <p> * The partitioner created by this method will expect values based on the * given {@code valuesType}: "string", "int", or "long". * * @param name * A name for the partitions * @param valuesType * A type string for values this partitioner will expect; one of * "string", "int", or "long". If null, the default is "string". * @return This builder for method chaining * * @since 0.17.0 */ public Builder provided(String name, @Nullable String valuesType) { add(PartitionFunctions.provided(name, valuesType)); return this; }
/** * Configure a hash partitioner with the specified number of * {@code buckets}. If name is null, the partition name will be the source * field name with a "_hash" suffix. For example, hash("color", null, 34) * will create "color_hash" partitions. * * @param sourceName * The entity field name from which to get values to be * partitioned. * @param name * The entity field name of the partition. * @param buckets * 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; }
/** * Configure a range partitioner with a set of {@code upperBounds}. * * The partition name will be the source field name with a "_bound" suffix. * For example, range("number", 5, 10) creates "number_bound" * partitions. * * @param sourceName * The entity field name from which to get values to be * partitioned. * @param upperBounds * A variadic list of upper bounds of each partition. * @return An instance of the builder for method chaining. * @see IntRangeFieldPartitioner */ public Builder range(String sourceName, int... upperBounds) { add(new IntRangeFieldPartitioner(sourceName, upperBounds)); return this; }
/** * Configure an identity partitioner. * * The partition name is the source field name with a "_copy" suffix. * For example, identity("color", String.class, 34) creates "color_copy" * partitions. * * @param sourceName * The entity field name from which to get values to be * partitioned. * @return An instance of the builder for method chaining. * @see IdentityFieldPartitioner * @since 0.14.0 */ @SuppressWarnings("unchecked") public Builder identity(String sourceName) { add(new IdentityFieldPartitioner(sourceName, Object.class)); return this; }
/** * Configure an identity partitioner. If name is null, the partition name * will be the source field name with a "_copy" suffix. For example, * identity("color", null, ...) will create "color_copy" partitions. * * @param sourceName * The entity field name from which to get values to be * partitioned. * @param name * A name for the partition field * @return An instance of the builder for method chaining. * @see IdentityFieldPartitioner * @since 0.14.0 */ @SuppressWarnings("unchecked") public Builder identity(String sourceName, String name) { add(new IdentityFieldPartitioner(sourceName, name, Object.class)); return this; }
/** * Configure a hash partitioner with the specified number of * {@code buckets}. * * The partition name is the source field name with a "_hash" suffix. * For example, hash("color", 34) creates "color_hash" partitions. * * @param sourceName * The entity field name from which to get values to be * partitioned. * @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; }
/** * Configure a partitioner for extracting the hour from a timestamp field. * The UTC timezone is assumed. If name is null, the partition entity name * will be "hour". * * @param sourceName * The entity field name from which to get values to be * partitioned. * @param name * The entity field name of the partition. * @return An instance of the builder for method chaining. * @since 0.3.0 */ public Builder hour(String sourceName, @Nullable String name) { add(new HourFieldPartitioner(sourceName, name)); return this; }
/** * Configure a partitioner for extracting the day from a timestamp field. * The UTC timezone is assumed. If name is null, the partition entity name * will be "day". * * @param sourceName * The entity field name from which to get values to be * partitioned. * @param name * The entity field name of the partition. * @return An instance of the builder for method chaining. * @since 0.3.0 */ public Builder day(String sourceName, @Nullable String name) { add(new DayOfMonthFieldPartitioner(sourceName, name)); return this; }
/** * Configure a range partitioner for strings with a set of {@code upperBounds}. * * The partition name will be the source field name with a "_bound" suffix. * For example, range("color", "blue", "green") creates "color_bound" * partitions. * * @param sourceName * The entity field name from which to get values to be * partitioned. * @param upperBounds * A variadic list of upper bounds of each partition. * @return An instance of the builder for method chaining. */ public Builder range(String sourceName, String... upperBounds) { add(new RangeFieldPartitioner(sourceName, upperBounds)); return this; }
/** * Configure a partitioner that applies a custom date format to a timestamp * field. The UTC timezone is assumed. * * @param sourceName * The entity field name of the timestamp to format * @param name * A name for the partitions created by the format (e.g. "day") * @param format * A {@link java.text.SimpleDateFormat} format-string. * @return This builder for method chaining. * @since 0.9.0 */ public Builder dateFormat(String sourceName, String name, String format) { add(PartitionFunctions.dateFormat(sourceName, name, format)); return this; }
/** * Configure a partitioner that uses values always provided at runtime. * <p> * The partitioner created by this method will expect {@link String} values. * * @param name * A name for the partitions * @return This builder for method chaining * * @since 0.17.0 */ public Builder provided(String name) { add(PartitionFunctions.provided(name, null)); return this; }
/** * Configure a partitioner for extracting the minute from a timestamp field. * The UTC timezone is assumed. The partition entity name is "minute". * * @param sourceName * The entity field name from which to get values to be * partitioned. * @return An instance of the builder for method chaining. * @since 0.8.0 */ public Builder minute(String sourceName) { add(new MinuteFieldPartitioner(sourceName)); return this; }
/** * Configure a partitioner for extracting the year from a timestamp field. * The UTC timezone is assumed. The partition entity name is "year". * * @param sourceName * The entity field name from which to get values to be * partitioned. * @return An instance of the builder for method chaining. * @since 0.8.0 */ public Builder year(String sourceName) { add(new YearFieldPartitioner(sourceName)); return this; }
/** * Configure a partitioner for extracting the hour from a timestamp field. * The UTC timezone is assumed. The partition entity name is "hour". * * @param sourceName * The entity field name from which to get values to be * partitioned. * @return An instance of the builder for method chaining. * @since 0.8.0 */ public Builder hour(String sourceName) { add(new HourFieldPartitioner(sourceName)); return this; }
/** * Configure a partitioner for extracting the day from a timestamp field. * The UTC timezone is assumed. The partition entity name is "day". * * @param sourceName * The entity field name from which to get values to be * partitioned. * @return An instance of the builder for method chaining. * @since 0.8.0 */ public Builder day(String sourceName) { add(new DayOfMonthFieldPartitioner(sourceName)); return this; }
/** * Configure a partitioner for extracting the month from a timestamp field. * The UTC timezone is assumed. The partition entity name is "month". * * @param sourceName * The entity field name from which to get values to be * partitioned. * @return An instance of the builder for method chaining. * @since 0.8.0 */ public Builder month(String sourceName) { add(new MonthFieldPartitioner(sourceName)); return this; }