[ https://issues.apache.org/jira/browse/FLINK-7371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16206093#comment-16206093 ]
ASF GitHub Bot commented on FLINK-7371: --------------------------------------- Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/4736 > user defined aggregator assumes nr of arguments smaller or equal than number > of row fields > ------------------------------------------------------------------------------------------ > > Key: FLINK-7371 > URL: https://issues.apache.org/jira/browse/FLINK-7371 > Project: Flink > Issue Type: Bug > Components: Table API & SQL > Affects Versions: 1.3.1 > Reporter: Stefano Bortoli > Assignee: Timo Walther > Priority: Blocker > Fix For: 1.4.0 > > > The definition of user define aggregations with a number of parameters larger > than the row fields causes ArrayIndexOutOfBoundsException because the > indexing is based on a linear iteration over row fields. This does not > consider cases where fields can be used more than once and constant values > are passed to the aggregation function. > for example: > {code} > window(partition {} order by [2] rows between $5 PRECEDING and CURRENT ROW > aggs [myAgg($0, $1, $3, $0, $4)]) > {code} > where $3 and $4 are reference to constants, and $0 and $1 are fields causes: > {code} > java.lang.ArrayIndexOutOfBoundsException: 4 > at > org.apache.flink.table.plan.schema.RowSchema.mapIndex(RowSchema.scala:134) > at > org.apache.flink.table.plan.schema.RowSchema$$anonfun$mapAggregateCall$1.apply(RowSchema.scala:147) > at > org.apache.flink.table.plan.schema.RowSchema$$anonfun$mapAggregateCall$1.apply(RowSchema.scala:147) > at > scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) > at > scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) > at scala.collection.Iterator$class.foreach(Iterator.scala:727) > at scala.collection.AbstractIterator.foreach(Iterator.scala:1157) > at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) > at scala.collection.AbstractIterable.foreach(Iterable.scala:54) > at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) > at scala.collection.AbstractTraversable.map(Traversable.scala:105) > at > org.apache.flink.table.plan.schema.RowSchema.mapAggregateCall(RowSchema.scala:147) > at > org.apache.flink.table.plan.nodes.datastream.DataStreamOverAggregate$$anonfun$9.apply(DataStreamOverAggregate.scala:362) > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)