Github user twalthr commented on a diff in the pull request: https://github.com/apache/flink/pull/2976#discussion_r94965456 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/aggregate/AggregateUtil.scala --- @@ -349,6 +354,19 @@ object AggregateUtil { (groupingOffsetMapping, aggOffsetMapping) } + private def getGroupingSetsMapping(outputType: RelDataType): Array[(Int, Int)] = { + val fields = outputType.getFieldList + var mappingsBuffer = ArrayBuffer[(Int, Int)]() + for (i <- fields.indices) { + for (j <- fields.indices) { + if (fields(j).getName.equals("i$" + fields(i).getName)) { --- End diff -- I know that it is unlikely but this could result in undesired behavior if the table contains `i$test` and `test`. Isn't there a nicer way to determine the grouping set mappings.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---