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

Add SAFE_CAST (BigQuery compatibility)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.35.0
    • None
    • None

    Description

      Implement SAFE_CAST per BigQuery specifications
      https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#safe_casting

      Equivalent to CAST(), except it will return null instead of throwing an exception if the casting fails.

      SAFE_CAST('1' as INT) -> 1
      SAFE_CAST('a' as INT) -> NULL
      SAFE_CAST("2022-12-12" as DATE) -> DATE('2022-12-12')

      SAFE_CAST(1 AS BOOLEAN) -> true

      SAFE_CAST('A' AS BOOLEAN) -> null

       

      Attachments

        Issue Links

          Activity

            People

              oliverlee Oliver Lee
              oliverlee Oliver Lee
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: