commit | 4e679f03771c89ffa463051b5698ead1d935748b | [log] [tgz] |
---|---|---|
author | Rafay <rafay@dremio.com> | Thu Jun 03 12:54:08 2021 -0700 |
committer | amaliujia <amaliujia@163.com> | Sun Jun 13 14:54:49 2021 -0700 |
tree | 59ce67d4bfad0605751e5722113dd0e91dea5885 | |
parent | e5477e7cda4ed9747d970b830d1fe9c53c49f2f3 [diff] |
[CALCITE-4636] Switch out of agg mode when constructing RelCollation for aggregate functions (Rafay) When we create RelCollation for WITHIN GROUP clause, we try to find the node in the group set first, which returns a RexNode which references the current group set instead of the field in the input. If the field is present in the group set, its index may not match with the field index in the input node, hence we get a mismatch, and then we wrongly add a new expression in SqlToRelConverter.AggConverter#lookupOrCreateGroupExpr method. The solution is to disable the agg mode, which will force the SqlToRelConverter.Blackboard#convertExpression function to return the correct RexNode referencing from the input, without looking in the grouping set.
Apache Calcite is a dynamic data management framework.
It contains many of the pieces that comprise a typical database management system but omits the storage primitives. It provides an industry standard SQL parser and validator, a customisable optimizer with pluggable rules and cost functions, logical and physical algebraic operators, various transformation algorithms from SQL to algebra (and the opposite), and many adapters for executing SQL queries over Cassandra, Druid, Elasticsearch, MongoDB, Kafka, and others, with minimal configuration.
For more details, see the home page.