Hi there,
Using jdbc adapter in the latest calcite (1.11.0) build i can not perform
windows aggregations. While converting the Rel into SQL the
RelImplementation drops the 'OVER(...)' blocks.
For example if you try the following sql query against Postgres db:
SELECT "id", "device_id", "transaction_value", "account_id", "ts_millis",
MAX("ts_millis") OVER(partition by "device_id") as
"last_version_number"
FROM "HAWQ"."transaction"
WHERE "device_id" = 1445
The result sql would look like this:
[SELECT "id", "device_id", "transaction_value", "account_id", "ts_millis",
MAX("ts_millis") AS "last_version_number"
FROM "transaction"
WHERE "device_id" = 1445]
e.g. the entire OVER block is ignored.
I've managed to track the problem down the SqlImplementeror#571-7594 (
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java#L571-L594
)
There the RexOver is casted to (and handled as) RexCall instance and the
RexOver#window is completely ignored.
This looks like a problem to me. Shall i open a Jira ticket for it?
Also what should be the right way to include the RexWindow attribute in the
SQL generation?
Cheers,
Christian
--
Christian Tzolov <http://www.linkedin.com/in/tzolov> | Solution Architect,
EMEA Practice Team | Pivotal <http://pivotal.io/>
[email protected]|+31610285517