[
https://issues.apache.org/jira/browse/FLINK-5303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15804951#comment-15804951
]
ASF GitHub Bot commented on FLINK-5303:
---------------------------------------
Github user twalthr commented on a diff in the pull request:
https://github.com/apache/flink/pull/2976#discussion_r94962145
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/dataSet/DataSetAggregateRule.scala
---
@@ -50,30 +48,48 @@ class DataSetAggregateRule
throw TableException("DISTINCT aggregates are currently not
supported.")
}
- // check if we have grouping sets
- val groupSets = agg.getGroupSets.size() != 1 ||
agg.getGroupSets.get(0) != agg.getGroupSet
- if (groupSets || agg.indicator) {
- throw TableException("GROUPING SETS are currently not supported.")
- }
-
- !distinctAggs && !groupSets && !agg.indicator
+ !distinctAggs
}
override def convert(rel: RelNode): RelNode = {
val agg: LogicalAggregate = rel.asInstanceOf[LogicalAggregate]
val traitSet: RelTraitSet =
rel.getTraitSet.replace(DataSetConvention.INSTANCE)
val convInput: RelNode = RelOptRule.convert(agg.getInput,
DataSetConvention.INSTANCE)
- new DataSetAggregate(
- rel.getCluster,
- traitSet,
- convInput,
- agg.getNamedAggCalls,
- rel.getRowType,
- agg.getInput.getRowType,
- agg.getGroupSet.toArray)
+ if (agg.indicator) {
+ agg.groupSets.map(set =>
+ new DataSetAggregate(
+ rel.getCluster,
+ traitSet,
+ convInput,
+ agg.getNamedAggCalls,
+ rel.getRowType,
+ agg.getInput.getRowType,
+ set.toArray
+ ).asInstanceOf[RelNode]
+ ).reduce(
+ (rel1, rel2) => {
+ new DataSetUnion(
+ rel.getCluster,
+ traitSet,
+ rel1, rel2,
--- End diff --
Missing line break.
> Add CUBE/ROLLUP/GROUPING SETS operator in SQL
> ---------------------------------------------
>
> Key: FLINK-5303
> URL: https://issues.apache.org/jira/browse/FLINK-5303
> Project: Flink
> Issue Type: New Feature
> Components: Documentation, Table API & SQL
> Reporter: Alexander Chermenin
> Assignee: Alexander Chermenin
>
> Add support for such operators as CUBE, ROLLUP and GROUPING SETS in SQL.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)