calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rui Wang <amaliu...@apache.org>
Subject Re: SqlNode.toSqlString() not parseable by calcite?
Date Fri, 29 May 2020 17:54:03 GMT
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)".



[1]:
https://github.com/apache/calcite/blob/master/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java#L7174


-Rui

On Thu, May 28, 2020 at 1:01 PM Julian Hyde <jhyde@apache.org> wrote:

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message