[
https://issues.apache.org/jira/browse/FLINK-2556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14709492#comment-14709492
]
ASF GitHub Bot commented on FLINK-2556:
---------------------------------------
Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/1044#discussion_r37766532
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/operators/Keys.java ---
@@ -209,6 +209,9 @@ public ExpressionKeys(int[] groupingFields,
TypeInformation<T> type, boolean all
throw new InvalidProgramException("Specifying
keys via field positions is only valid " +
"for tuple data types. Type: "
+ type);
}
+ if (type.getArity() == 0) {
+ throw new InvalidProgramException("Tuple size
must be greater than 0. Size: " + type.getArity());
--- End diff --
this check was added specifically for Tuple0, as in the current code you'd
get weird exceptions when grouping on a Tuple0.
> Fix/Refactor pre-flight Key validation
> --------------------------------------
>
> Key: FLINK-2556
> URL: https://issues.apache.org/jira/browse/FLINK-2556
> Project: Flink
> Issue Type: Bug
> Components: Java API
> Reporter: Chesnay Schepler
> Assignee: Chesnay Schepler
>
> The pre-flight key validation checks are inconsistent, at times don't
> actually check anything and in at least 1 case are done redundantly.
> For example,
> * you can group on a tuple containing a non-Atomic-/CompositeType using
> String[] KeyExpressions (see FLINK-2541)
> * you can group on an AtomicType even though isKeyType() returns false, if it
> is contained in a tuple
> * for distinct(String[]...) the above fails in the DistinctOperator
> constructor, as it validates the key again for some reason.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)