apache / apache/beam

Cast function cannot convert value of type INTEGER to type BOOLEAN

Open
#20,743 0 comments 0 reactions 0 assignees View on GitHub
bug dsl P3 sql
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

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:
 
```

,CASE WHEN cast(IsService as BOOLEAN) THEN CASE WHEN IsEligible THEN 1 ELSE 0 END ELSE NULL END AS
Reported

```

Where IsService is an indicator int and IsEligible is a boolean.
 
 I get the below error when I run the pipeline:
 
```

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

```

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

Imported from Jira [BEAM-11667](https://issues.apache.org/jira/browse/BEAM-11667). Original Jira may contain additional context.
Reported by: arto08.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.