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

CAST(BOOLEAN as INTEGER) throws a NumberFormatException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.35.0
    • None

    Description

      Currently attempting to run SELECT CAST(BOOLEAN as INTEGER) will throw a NumberFormatException.

      The BigQuery dialect allows casting boolean literals to the following: string, int64 , tinyint, smallint, bigint

      src: https://cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions

      Desired behavior:

      SELECT CAST(TRUE as INTEGER) -> 1
      SELECT CAST(TRUE as BIGINT) -> 1
      SELECT CAST(FALSE as INTEGER) -> 0
      SELECT CAST(null as INTEGER) -> null

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m