Github user gallenvara commented on a diff in the pull request:
https://github.com/apache/flink/pull/1838#discussion_r59819652
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/operators/PartitionOperator.java
---
@@ -84,8 +84,8 @@ public PartitionOperator(DataSet<T> input, Keys<T> pKeys,
Partitioner<?> customP
Preconditions.checkArgument(distribution == null || pMethod ==
PartitionMethod.RANGE, "Customized data distribution is only neccessary for
range partition.");
if (distribution != null) {
-
Preconditions.checkArgument(distribution.getNumberOfFields() ==
pKeys.getNumberOfKeyFields(), "The number of key fields in the distribution and
range partitioner should be the same.");
-
Preconditions.checkArgument(Arrays.equals(distribution.getKeyTypes(),
pKeys.getKeyFieldTypes()), "The types of key from the distribution and range
partitioner are not equal.");
+
Preconditions.checkArgument(pKeys.getNumberOfKeyFields() <=
distribution.getNumberOfFields(), "The number of key fields in range
partitioner should be less than the number in the distribution.");
+
Preconditions.checkArgument(Arrays.equals(pKeys.getKeyFieldTypes(),
Arrays.copyOfRange(distribution.getKeyTypes(), 0,
pKeys.getNumberOfKeyFields())), "The type array of the partition key should be
prefix of the type array of the distribution.");
--- End diff --
:) i will improve my poor English skill.
---
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.
---