calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <jh...@apache.org>
Subject Re: SqlNode.toSqlString() not parseable by calcite?
Date Thu, 28 May 2020 20:01:36 GMT
Are you aware of SqlUnParserTest? It runs each query in SqlParserTest,
converts the AST to SQL, and makes sure that that SQL can be parsed.


On Thu, May 28, 2020 at 2:14 AM Bozo Dragojevic <bozzo@digiverse.si> wrote:
>
> Hi!
>
>
> In trying to fix https://issues.apache.org/jira/browse/DRILL-7722
>
> I think the path leads to calcite...
>
>
> So a question, is SqlNode.toSqlString() supposed to produce a SQL string
>
> that is parseable by calcite?
>
>
> I've created this little change to the TesterImpl.check() method to also
> parse the expected result
>
> and that fails for all the tests. Is this behavior by design?
>
>
> Cheers,
>
> Bozzo
>
>
> -----
>
> $ git diff
> diff --git
> a/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java
> b/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java
> index 21b664fb4..0c79a16b6 100644
> --- a/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java
> +++ b/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java
> @@ -8838,6 +8838,10 @@ public void check(String sql, SqlDialect dialect,
> String expected,
>            dialect == null ? UnaryOperator.identity() :
> dialect::configureParser,
>            parserChecker);
>        check(sqlNode, dialect, expected);
> +      final SqlNode expectedSqlNode  = parseStmtAndHandleEx(expected,
> +          dialect == null ? UnaryOperator.identity() :
> dialect::configureParser,
> +          parserChecker);
> +      check(expectedSqlNode, dialect, expected);
>      }
>
>      protected SqlNode parseStmtAndHandleEx(String sql,

Mime
View raw message