You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Stefano Bortoli (JIRA)" <ji...@apache.org> on 2017/08/01 16:50:00 UTC
[jira] [Commented] (FLINK-7339) aggregationToString fails when user
defined aggregation contains constants
[ https://issues.apache.org/jira/browse/FLINK-7339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16109275#comment-16109275 ]
Stefano Bortoli commented on FLINK-7339:
----------------------------------------
{code}
java.lang.RuntimeException: Error while applying rule DataStreamOverAggregateRule, args [rel#649:FlinkLogicalOverWindow.LOGICAL(input=rel#648:Subset#5.LOGICAL,window#0=window(partition {} order by [2] range between $4 PRECEDING and CURRENT ROW aggs [myAggs($0, $1, $3)]))]
at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:310)
at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:293)
at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:67)
at org.apache.calcite.util.Pair$6.get(Pair.java:347)
at scala.collection.convert.Wrappers$JListWrapper.apply(Wrappers.scala:88)
at org.apache.flink.table.plan.nodes.OverAggregate$$anonfun$3$$anonfun$apply$1.apply(OverAggregate.scala:75)
at org.apache.flink.table.plan.nodes.OverAggregate$$anonfun$3$$anonfun$apply$1.apply(OverAggregate.scala:75)
{code}
> aggregationToString fails when user defined aggregation contains constants
> --------------------------------------------------------------------------
>
> Key: FLINK-7339
> URL: https://issues.apache.org/jira/browse/FLINK-7339
> Project: Flink
> Issue Type: Bug
> Components: DataStream API, Table API & SQL
> Affects Versions: 1.3.1
> Reporter: Stefano Bortoli
>
> Issue related to FLINK-7338, when the user defined aggregation contains a constant it breaks the aggregation translation to string, which are mapped 1 to 1 to the input fields.
> OverAggregates.scala aggregationToString function fails to find a parameter of the function among the input fields, and therefore throws a RuntimeException.
> {code}
> private[flink] def aggregationToString(
> inputType: RelDataType,
> rowType: RelDataType,
> namedAggregates: Seq[CalcitePair[AggregateCall, String]]): String = {
> val inFields = inputType.getFieldNames.asScala
> val outFields = rowType.getFieldNames.asScala
> val aggStrings = namedAggregates.map(_.getKey).map(
> a => s"${a.getAggregation}(${
> if (a.getArgList.size() > 0) {
> // ERROR HAPPENS HERE!
> a.getArgList.asScala.map(inFields(_)).mkString(", ")
> } else {
> "*"
> }
> })")
> (inFields ++ aggStrings).zip(outFields).map {
> case (f, o) => if (f == o) {
> f
> } else {
> s"$f AS $o"
> }
> }.mkString(", ")
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)