There are a lot of open PRs, so it's easy for one to fall through the cracks.

I think you should answer a simple question: what is the correct grammar? You 
are making it look like you are tweaking the grammar to allow it to parse what 
the output of the compiler is. But that's the wrong question. The compiler 
should output what the correct output is.

"Correct" is defined as in "specified by the standard" or "supported by other 
databases".

I didn't review your PR because I don't know the answer to this last question.

Mihai

________________________________
From: Zhang, Juntao
Sent: Monday, April 14, 2025 9:03 PM
To: dev@calcite.apache.org
Subject: [DISCUSS] (CALCITE-6944)Cannot parse parenthesized partition by in 
Table Function

Hi team,
For  https://issues.apache.org/jira/browse/CALCITE-6944,  I’m happy to make the 
GitHub Pull Request #4295<https://github.com/apache/calcite/pull/4295> to fix 
it as well if we think its worth fixing. Can someone tell me how to move 
forward?

This the issue of an extra parenthesis in the table function.
Why there is an extra parenthesis?
Currently toSqlString this method will add parentheses, which means that the 
SQL after toSqlString cannot be parsed.

Test example:
    String sqlExpected = "f(a => TABLE t PARTITION BY f1 ORDER BY f2, b => 1)";
    String sqlActual = parseExpression(sqlExpected)
        .toSqlString(new AnsiSqlDialect(SqlDialect.EMPTY_CONTEXT)).getSql();
    parseExpression(sqlActual);

Thanks
Juntao

Reply via email to