I think Calcite could improve on this case. Just logged
https://jira.apache.org/jira/browse/CALCITE-4033



-Rui

On Sat, May 30, 2020 at 9:57 AM Bozo Dragojevic <[email protected]> wrote:

> What I learned today about calcite is that it supports an
> impressive number of dialects so the calcite may in fact be OK
> (as drill parses the 'LATERAL (select * from UNNEST)" perfectly
> when I enter it as a *query*. when I enter it as a view definition
> with CREATE VIEW then the query text that drill saves to the view
> definition file is transformed in a way similar to the difference
> between actual and expected result in [1] which is the extra parenthesis
> around the UNNEST expression. Selecting from such view raises a parse
> error for UNNEST having extra parentheses.
>
> So from outside it looks that drill uses parse -> unparse -> parse
> sequence when querying the view.
>
> Maybe the fix is to change drill to just store the original query.
> But it seems that calcite tries to go to great lengths to have roundtrip
> capability just for users like drill.
>
> So I think the error lies either in calcite if there is some bug with
> unparse, or
> more likely, in drill as it configures the unparser with a dialect that is
> not
> comptible with the dialect it's parsing with.
>
>
> Cheers,
> Bozzo
>
> [1]
> https://github.com/apache/calcite/blob/master/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java#L7154
>
> On 29/05/2020 19:54, Rui Wang wrote:
> > You might try to add a test case at [1]. Based on your Drill JIRA, you
> > might test the syntax containing "Literal (select * from UNNEST)".
> >
> >
> >
>
>

Reply via email to