Cast function cannot convert value of type INTEGER to type BOOLEAN
- 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
Assessment
This issue has not been assessed yet.