[jira] [Created] (FLINK-19006) project transformation does not support conversion to Tuple25 type

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-19006) project transformation does not support conversion to Tuple25 type

Shang Yuanchun (Jira)
ming li created FLINK-19006:
-------------------------------

             Summary: 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


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)