Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2571

TRIM does not match the behavior of most SQL implementations

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.18.0
    • core
    • None

    Description

      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

      Attachments

        Activity

          People

            julianhyde Julian Hyde
            apilloud Andrew Pilloud
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: