[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (CALCITE-2571) TRIM does not match the behavior of most SQL implementations

Andrew Pilloud created CALCITE-2571:

             Summary: 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

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