You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ming li (Jira)" <ji...@apache.org> on 2020/08/26 13:23:00 UTC
[jira] [Comment Edited] (FLINK-19006) project transformation does
not support conversion to Tuple25 type
[ https://issues.apache.org/jira/browse/FLINK-19006?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17185184#comment-17185184 ]
ming li edited comment on FLINK-19006 at 8/26/20, 1:22 PM:
-----------------------------------------------------------
Hi,[~ting.lt]. I am not sure who is responsible for this module, maybe you can consult [~trohrmann].
was (Author: ming li):
Hi,[~ting.lt]. I am not sure who is responsible for this module, maybe you can consult [~trohrmann]
> project transformation does not support conversion to Tuple25 type
> ------------------------------------------------------------------
>
> Key: FLINK-19006
> URL: https://issues.apache.org/jira/browse/FLINK-19006
> Project: Flink
> Issue Type: Improvement
> Components: API / DataStream
> Affects Versions: 1.11.1
> Reporter: ming li
> Priority: Major
>
> In the {{DataStream#project}} method, it will judge whether the length of {{fieldIndexes}} is between 1 and {{Tuple.MAX_ARITY-1}}, and then call {{projectTupleXX}} according to the length of {{fieldIndexes}}. This limits the maximum length of {{Tuple}} to 24.
> {code:java}
> protected StreamProjection(DataStream<IN> dataStream, int[] fieldIndexes) {
> if (!dataStream.getType().isTupleType()) {
> throw new RuntimeException("Only Tuple DataStreams can be projected");
> }
> if (fieldIndexes.length == 0) {
> throw new IllegalArgumentException("project() needs to select at least one (1) field.");
> } else if (fieldIndexes.length > Tuple.MAX_ARITY - 1) {
> throw new IllegalArgumentException(
> "project() may select only up to (" + (Tuple.MAX_ARITY - 1) + ") fields.");
> }
> int maxFieldIndex = (dataStream.getType()).getArity();
> for (int i = 0; i < fieldIndexes.length; i++) {
> Preconditions.checkElementIndex(fieldIndexes[i], maxFieldIndex);
> }
> this.dataStream = dataStream;
> this.fieldIndexes = fieldIndexes;
> }{code}
> This problem also appears in {{ProjectOperator}}.
> {code:java}
> public Projection(DataSet<T> ds, int[] fieldIndexes) {
> if (!(ds.getType() instanceof TupleTypeInfo)) {
> throw new UnsupportedOperationException("project() can only be applied to DataSets of Tuples.");
> }
> if (fieldIndexes.length == 0) {
> throw new IllegalArgumentException("project() needs to select at least one (1) field.");
> } else if (fieldIndexes.length > Tuple.MAX_ARITY - 1) {
> throw new IllegalArgumentException(
> "project() may select only up to (" + (Tuple.MAX_ARITY - 1) + ") fields.");
> }
> int maxFieldIndex = ds.getType().getArity();
> for (int fieldIndexe : fieldIndexes) {
> Preconditions.checkElementIndex(fieldIndexe, maxFieldIndex);
> }
> this.ds = ds;
> this.fieldIndexes = fieldIndexes;
> }{code}
> I think the length we limit should be 1 to {{Tuple.MAX_ARITY}} instead of 1 to {{Tuple.MAX_ARITY-1}}.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)