You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Jordan Hannel <jo...@netspring.io> on 2023/09/20 19:39:55 UTC
Possible bug found in SqlToRelConverter
Hello all,
I believe I have found a bug in SqlToRelConverter. The symptom and repro
are outlined below, and the full stacktrace is attached. This is on calcite
version 1.35.0. Any insight would be much appreciated, thanks!
When I parse the below SQL string to get a SqlNode, and call
SqlToRelConverter.convertQuery on this SqlNode, I get a
UnsupportedOperationException: class org.apache.calcite.sql.SqlBasicCall:
LEAD(COUNT(*)) OVER (ORDER BY `dim4`)
SELECT "dim4" AS "dim7",
LEAD(COUNT(*), -1) OVER (ORDER BY "dim4") AS "measure10"
FROM (
SELECT "timestamp" AS "dim4"
FROM "Shared.factDataset") AS "t0"
GROUP BY "dim4"
I have confirmed that my SqlToRelConverter instance seems generally ok,
because it is able to convert many other SqlNodes to RelNodes.
After some experimentation, I noticed that just changing `ORDER BY "dim4"`
to `ORDER BY "t0"."dim4"` fixes the issue - after that, the SqlNode
successfully is translated to a RelNode.
--
[image: Download the Buyers Guide for Warehouse-Native Product Analytics]
<https://www.netspring.io/resources/buyers-guide/>
*Jordie Hannel*
Founding Product Owner
www.netspring.io
Re: Possible bug found in SqlToRelConverter
Posted by Julian Hyde <jh...@gmail.com>.
That sounds like a bug. Can you please log a jira case?
The fix might be in SqlValidatorImpl’s identifier expansion, even though the problem shows up in SqlToRelConverter.
> On Sep 20, 2023, at 12:39 PM, Jordan Hannel <jo...@netspring.io> wrote:
>
> Hello all,
> I believe I have found a bug in SqlToRelConverter. The symptom and repro are outlined below, and the full stacktrace is attached. This is on calcite version 1.35.0. Any insight would be much appreciated, thanks!
>
> When I parse the below SQL string to get a SqlNode, and call SqlToRelConverter.convertQuery on this SqlNode, I get a UnsupportedOperationException: class org.apache.calcite.sql.SqlBasicCall: LEAD(COUNT(*)) OVER (ORDER BY `dim4`)
>
> SELECT "dim4" AS "dim7",
> LEAD(COUNT(*), -1) OVER (ORDER BY "dim4") AS "measure10"
> FROM (
> SELECT "timestamp" AS "dim4"
> FROM "Shared.factDataset") AS "t0"
> GROUP BY "dim4"
>
> I have confirmed that my SqlToRelConverter instance seems generally ok, because it is able to convert many other SqlNodes to RelNodes.
> After some experimentation, I noticed that just changing `ORDER BY "dim4"` to `ORDER BY "t0"."dim4"` fixes the issue - after that, the SqlNode successfully is translated to a RelNode.
>
> --
> <https://www.netspring.io/resources/buyers-guide/>
> Jordie Hannel
> Founding Product Owner
> www.netspring.io <http://www.netspring.io/><stacktrace.txt>