[ https://issues.apache.org/jira/browse/CALCITE-3220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Hyde updated CALCITE-3220: --------------------------------- Description: Let's assume sql = SELECT TRIM(' str ') When we use HiveSqlDialect and transform "sql", we expect SELECT TRIM(' str '),but get SELECT TRIM(BOTH ' ' FROM ' str ') which is incorrect sql format in hive. So maybe HiveSqlDialect behavior should be changed when transform function trim: # {{SELECT TRIM(' str ') => SELECT TRIM(' str ') }} # {{SELECT TRIM(BOTH ' ' from ' str ') => SELECT TRIM(' str ')}} # {{SELECT TRIM(LEADING ' ' from ' str ') => SELECT LTRIM(' str ')}} # {{SELECT TRIM(TRAILING ' ' from ' str ')=> SELECT RTRIM(' str ') }} was: Let's assume sql = SELECT TRIM(' str ') When we use HiveSqlDialect and transform "sql", we expect SELECT TRIM(' str '),but get SELECT TRIM(BOTH ' ' FROM ' str ') which is incorrect sql format in hive. So maybe HiveSqlDialect behavior should be changed when transform function trim: # {{SELECT TRIM(' str ') => SELECT TRIM(' str ') }} # {{SELECT TRIM(BOTH ' ' from ' str ') => SELECT TRIM(' str ')}} # {{SELECT TRIM(LEADING ' ' from ' str ') => SELECT LTRIM(' str ')}} # {{SELECT TRIM(TRAILING ' ' from ' str ')=> SELECT RTRIM(' str ') }} {{This is the linked github pr #1342 [https://github.com/apache/calcite/pull/1342]}} > In JDBC adapter, when generating SQL for Hive, transform TRIM function to > TRIM, LTRIM or RTRIM > ---------------------------------------------------------------------------------------------- > > Key: CALCITE-3220 > URL: https://issues.apache.org/jira/browse/CALCITE-3220 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.19.0 > Reporter: Jacky Woo > Assignee: Julian Hyde > Priority: Minor > Labels: pull-request-available > Fix For: 1.21.0 > > Time Spent: 40m > Remaining Estimate: 0h > > Let's assume sql = SELECT TRIM(' str ') > When we use HiveSqlDialect and transform "sql", we expect SELECT TRIM(' str > '),but get SELECT TRIM(BOTH ' ' FROM ' str ') which is incorrect sql format > in hive. > So maybe HiveSqlDialect behavior should be changed when transform function > trim: > # {{SELECT TRIM(' str ') => SELECT TRIM(' str ') }} > # {{SELECT TRIM(BOTH ' ' from ' str ') => SELECT TRIM(' str ')}} > # {{SELECT TRIM(LEADING ' ' from ' str ') => SELECT LTRIM(' str ')}} > # {{SELECT TRIM(TRAILING ' ' from ' str ')=> SELECT RTRIM(' str ') }} -- This message was sent by Atlassian Jira (v8.3.2#803003)