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

Oliver Lee commented on CALCITE-5662:
-------------------------------------

I've updated the PR with the suggestions. Great that it doesn't touch so many 
files now, thanks.

One thing outstanding is this test that I'm not sure how to handle: 
[https://github.com/apache/calcite/blob/main/core/src/test/java/org/apache/calcite/test/TypeCoercionConverterTest.java#L96]
 

It fails this assert: 
[https://github.com/apache/calcite/pull/3168/files#diff-5329511594ea917eb4981315d7f531630c9b0e10979e7228c748156f1ea74b88R286]

since we are changing the default behavior to not support casting boolean to 
integers. 

 

> CAST(BOOLEAN as INTEGER) throws a NumberFormatException
> -------------------------------------------------------
>
>                 Key: CALCITE-5662
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5662
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Oliver Lee
>            Assignee: Oliver Lee
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to