[
https://issues.apache.org/jira/browse/FLINK-1112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14229903#comment-14229903
]
ASF GitHub Bot commented on FLINK-1112:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/incubator-flink/pull/209#discussion_r21094820
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/operators/SortedGrouping.java
---
@@ -83,6 +84,30 @@ public SortedGrouping(DataSet<T> set, Keys<T> keys,
String field, Order order) {
this.groupSortOrders = new Order[groupSortKeyPositions.length];
Arrays.fill(this.groupSortOrders, order); // if field == "*"
}
+
+ /*
+ * KeySelector sorting for Pojos and tuples
+ */
+ public <K> SortedGrouping(DataSet<T> set, Keys<T> keys,
Keys.SelectorFunctionKeys<T, K> keySelector, Order order) {
+ super(set, keys);
+
+ if (!(this.keys instanceof Keys.SelectorFunctionKeys)) {
+ throw new InvalidProgramException("Sorting on
KeySelector only works for KeySelector grouping.");
+ }
+
+ if (!(dataSet.getType() instanceof CompositeType)) {
+ throw new InvalidProgramException("Specifying order
keys via field positions is only valid for composite data types (pojo / tuple /
case class)");
--- End diff --
Error message says "field positions" but we are using KeySelectors instead.
> Add GroupSorting with KeySelectors
> ----------------------------------
>
> Key: FLINK-1112
> URL: https://issues.apache.org/jira/browse/FLINK-1112
> Project: Flink
> Issue Type: Improvement
> Components: Java API, Scala API
> Reporter: Fabian Hueske
> Assignee: Mingliang Qi
>
> Group sorting is currently only supported for field-index keys and not for
> KeySelectors.
> This feature was requested.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)