You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Aro Barret (Jira)" <ji...@apache.org> on 2021/01/20 17:40:00 UTC

[jira] [Created] (BEAM-11667) Cast function cannot convert value of type INTEGER to type BOOLEAN

Aro Barret created BEAM-11667:
---------------------------------

             Summary: Cast function cannot convert value of type INTEGER to type BOOLEAN
                 Key: BEAM-11667
                 URL: https://issues.apache.org/jira/browse/BEAM-11667
             Project: Beam
          Issue Type: Bug
          Components: beam-model
    Affects Versions: 2.24.0
            Reporter: Aro Barret


I'm trying to do a SQL transform using Calcite SQL syntax. I'm doing an int to boolean cast. My sql looks like this:
 
{code:java}
,CASE WHEN cast(IsService as BOOLEAN) THEN CASE WHEN IsEligible THEN 1 ELSE 0 END ELSE NULL END AS Reported
{code}
Where IsService is an indicator int and IsEligible is a boolean.
 
 I get the below error when I run the pipeline:
 
{code:java}
Caused by: org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.sql.validate.SqlValidatorException: Cast function cannot convert value of type INTEGER to type BOOLEAN

{code}
Calcite should be able to cast Int to boolean according to [documentation|https://calcite.apache.org/docs/reference.html#implicit-type-conversion] 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)