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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---