[ 
https://issues.apache.org/jira/browse/CALCITE-4471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17267120#comment-17267120
 ] 

yanjing.wang commented on CALCITE-4471:
---------------------------------------

I submitted a [PR|https://github.com/apache/calcite/pull/2328] to solve this 
problem

> "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
>            Priority: Major
>              Labels: pull-request-available
>         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
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to