yanjing.wang created CALCITE-4471:
-------------------------------------
Summary: "SqlBetweenOperator" should support writing optional
"ASYMMETRIC" or "SYMMETRIC" flag in "unparse" method
Key: CALCITE-4471
URL: https://issues.apache.org/jira/browse/CALCITE-4471
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.26.0
Environment: jvm: open-jdk8
Reporter: yanjing.wang
Attachments: image-2021-01-18-15-51-40-245.png,
image-2021-01-18-15-57-02-994.png, image-2021-01-18-15-57-22-436.png
when i unparse the following sql
{code:java}
String sql = "select concat(a.id,'-',b.id) , a.name from xxx.bb where dt
between '2020-10-04' AND '2020-10-09' limit 2";
{code}
i got the result
{code:java}
SELECT `CONCAT`(`A`.`ID`, '-', `B`.`ID`), `A`.`NAME` FROM `XXX`.`BB` WHERE `DS`
BETWEEN ASYMMETRIC '2020-10-04' AND '2020-10-09' LIMIT 2
{code}
the "ASYMMETRIC" keyword is not supported in spark dialect. and the "parser.jj"
file defines optional "ASYMMETRIC" and "SYMMETRIC" keyword.
!image-2021-01-18-15-51-40-245.png!
but "SqlBetweenOperator" writes the "flag" in hard code way.
!image-2021-01-18-15-57-02-994.png!
!image-2021-01-18-15-57-22-436.png!
the parse and unparse should keep the same syntax process.
my code is as follows
{code:java}
String sql = "select concat(a.id,'-',b.id) , a.name from xxx.bb where dt
between '2020-10-04' AND '2020-10-09' limit 2";
SqlParser sqlParser = SqlParser.create(sql, configBuilder); try { SqlNode
sqlNode = sqlParser.parseQuery(); SqlString sqlString =
sqlNode.toSqlString(SPARK); System.out.println(sqlString); } catch
(SqlParseException e) { e.printStackTrace(); }
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)