You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "lothar (Jira)" <ji...@apache.org> on 2020/08/25 10:03:00 UTC

[jira] [Commented] (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=17183899#comment-17183899 ] 

lothar commented on FLINK-19006:
--------------------------------

hello,[~Ming Li],I think I can solve the problem,I will modify this limits in StreamProjection.java and ProjectOperator.java

Could you assign this ticket to me ?

Thank You.

> 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)