Yu Xu created CALCITE-6999:
------------------------------

             Summary: Invalid unparse for TRIM in PrestoDialect
                 Key: CALCITE-6999
                 URL: https://issues.apache.org/jira/browse/CALCITE-6999
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.39.0
            Reporter: Yu Xu
            Assignee: Yu Xu
             Fix For: 1.40.0


sql not support as follow:

 
{code:java}
presto> SELECT TRIM(LEADING 'a' from 'abcd');
Query 20250504_062451_29862_cqcdm failed: line 1:25: mismatched input 'from'. 
Expecting: ',', <expression>

SELECT TRIM(TRAILING 'a' from 'abcd')
Query 20250504_062451_29863_cqcdm failed: line 1:25: mismatched input 'from'. 
Expecting: ',', <expression> 

SELECT TRIM(BOTH 'a' from 'abcd')
Query 20250504_062451_29863_cqcdm failed: line 1:25: mismatched input 'from'. 
Expecting: ',', <expression> {code}
 

so need convert to:
{code:java}
presto> SELECT TRIM('abcd', 'a');
> bcd 

presto> SELECT LTRIM('abcd', 'a');
> bcd 

presto> SELECT RTRIM('abcd', 'd');
> abc 

presto> SELECT TRIM(' abcd ');
> abcd{code}
we can also refer to doc 
[https://prestodb.io/docs/current/functions/string.html] by search 
trim/ltrim/rtrim functions

so we need to fix it by unparse trim correctly.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to