[
https://issues.apache.org/jira/browse/FLINK-3665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15245793#comment-15245793
]
ASF GitHub Bot commented on FLINK-3665:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/1848#discussion_r60071991
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/operators/PartitionOperator.java
---
@@ -98,6 +102,23 @@ public PartitionOperator(DataSet<T> input, Keys<T>
pKeys, Partitioner<?> customP
this.customPartitioner = customPartitioner;
this.distribution = distribution;
}
+
+ /**
+ * Sets the order of keys for range partitioning.
+ * NOTE: Only valid for {@link PartitionMethod.RANGE}.
+ *
+ * @param orders array of orders for each specified partition key
+ * @return The partitioneOperator with properly set orders for given
keys
+ */
+ @PublicEvolving
+ public PartitionOperator<T> withOrders(Order... orders) {
+ Preconditions.checkState(pMethod == PartitionMethod.RANGE,
"Orders cannot be applied for %s partition " +
+ "method", pMethod);
+
Preconditions.checkArgument(pKeys.getOriginalKeyFieldTypes().length ==
orders.length);
--- End diff --
Can you add a descriptive error message here?
> Range partitioning lacks support to define sort orders
> ------------------------------------------------------
>
> Key: FLINK-3665
> URL: https://issues.apache.org/jira/browse/FLINK-3665
> Project: Flink
> Issue Type: Improvement
> Components: DataSet API
> Affects Versions: 1.0.0
> Reporter: Fabian Hueske
> Fix For: 1.1.0
>
>
> {{DataSet.partitionByRange()}} does not allow to specify the sort order of
> fields. This is fine if range partitioning is used to reduce skewed
> partitioning.
> However, it is not sufficient if range partitioning is used to sort a data
> set in parallel.
> Since {{DataSet.partitionByRange()}} is {{@Public}} API and cannot be easily
> changed, I propose to add a method {{withOrders(Order... orders)}} to
> {{PartitionOperator}}. The method should throw an exception if the
> partitioning method of {{PartitionOperator}} is not range partitioning.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)