JacobZheng0927 opened a new issue, #13138:
URL: https://github.com/apache/seatunnel/issues/13138

   ### Search before asking
   
   I searched open and closed pull requests and issues for Arrow 
boolean/TINYINT conversion, StarRocks boolean schemas, and `Boolean cannot be 
cast to Byte`, and did not find a matching fix.
   
   ### What happened
   
   On current `dev` (`a3743d7f52`), `ArrowToSeatunnelRowReader` can emit a Java 
`Boolean` for a field declared as SeaTunnel `TINYINT`. Arrow's boolean vector 
returns a `Boolean`; the default converter forwards it, and the declared-type 
adaptation has no `TINYINT` case.
   
   A downstream JDBC sink expects `Byte` for `TINYINT` and fails at `(Byte) 
value` with:
   
   ```text
   java.lang.ClassCastException: class java.lang.Boolean cannot be cast to 
class java.lang.Byte
   ```
   
   This is independent of whether the destination database column is numeric or 
textual: the failure happens while binding the JDBC parameter.
   
   ### Expected behavior
   
   When an Arrow boolean field is explicitly declared as `TINYINT`, emit Java 
`Byte` values: `false -> 0`, `true -> 1`, and preserve `null`. A `BOOLEAN` 
schema should continue to emit booleans, and native numeric `TINYINT` values 
should remain unchanged.
   
   ### How to reproduce
   
   The minimal reader-level reproduction serializes an Arrow stream containing 
a `BitVector` with `false`, `true`, and `null`, then reads it with 
`BasicType.BYTE_TYPE`. The first output is currently `Boolean.FALSE` instead of 
`Byte.valueOf((byte) 0)`.
   
   For the connector path, use a native StarRocks source with a `BOOLEAN` 
column, declare that column as `TINYINT` in the source schema, and write to a 
JDBC sink with a `TINYINT` target column. Test values should include `false`, 
`true`, and `null`.
   
   ### SeaTunnel version
   
   Current development branch, `3.1.0-SNAPSHOT` at `a3743d7f52`.
   
   ### Validation so far
   
   The Arrow IPC regression fails before the fix and passes with 
boolean-to-byte normalization. All 17 tests in `connector-common` pass with the 
candidate fix. The real StarRocks-to-JDBC E2E is being run before submitting a 
pull request.
   
   ### Are you willing to submit a PR?
   
   Yes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to