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

Julian Hyde commented on CALCITE-2571:
--------------------------------------

This change added an {{allowExtendedTrim}} method to {{RelDataTypeSystemImpl}} 
and an anonymous derived class in {{SqlTestFactory}} but as far as I can tell 
those methods are never called. (Probably my mistake: as I was adding plumbing 
to {{SqlConformance}} I forgot to remove all the old plumbing.) I am going to 
remove those methods in CALCITE-4885.

The {{allowExtendedTrim}} method in {{SqlConformance}} is used, and is in fact 
crucial to this feature, and I'm not going to touch that.

> TRIM does not match the behavior of most SQL implementations
> ------------------------------------------------------------
>
>                 Key: CALCITE-2571
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2571
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Andrew Pilloud
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.18.0
>
>
> Most SQL implementations trim all characters if more then one is provided to 
> the trim function. Calcite's SqlFunctions implementation silently drops the 
> extra characters, resulting in data corruption.
> Here is a sampling of implementations that trim all characters:
> MySQL - 
> https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_trim
> Sql Server - 
> https://docs.microsoft.com/en-us/sql/t-sql/functions/trim-transact-sql?view=sql-server-2017
> Flink - 
> https://ci.apache.org/projects/flink/flink-docs-stable/dev/table/sql.html
> Spark - https://spark.apache.org/docs/2.3.0/api/sql/index.html#trim
> Postgres - https://www.postgresql.org/docs/9.1/static/functions-string.html
> SqLite - https://www.sqlite.org/lang_corefunc.html#trim
> Also see: CALCITE-2530 BEAM-4704



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to