[Bug]: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String issue with Boolean field
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 196
Description
### What happened?
**Beam version: 2.30**
**Flink version: 1.12.5**
When I tried to run my beam pipeline with **FlinkRunner**, I got this error -
`java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String`
Although when I ran it with beam **DirectRunner**, it ran fine with no error.
The field type on which this issue is occurring is of **Boolean** type. While reading from SQLServer 2008 DB, a Boolean field is treated as **Logical** type field. Here we are building the schema with the help of this method -
`Schema.Field booleanField = Schema.Field.nullable(name,Schema.FieldType.BOOLEAN);`
I managed to find a work around for this error with a slight change in the way I was building my schema :
`Schema.Field booleanField = Schema.Field.nullable(name,Schema.FieldType.of(Schema.TypeName.BOOLEAN));`
But shouldn't both of these code changes would have worked in the same way? The former has worked for me in previous versions.
I think there is some compatibility issue with Apache Beam and FlinkRunner on Boolean data type
### Issue Priority
Priority: 2
### Issue Component
Component: runner-flink
Contributor guide
Assessment
This issue has not been assessed yet.