You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "kawaii-box (via GitHub)" <gi...@apache.org> on 2026/04/25 06:17:03 UTC
[I] [Bug] [Connector-V2] ORC Source reader corrupts BINARY/BYTES data due to forced String casting [seatunnel]
kawaii-box opened a new issue, #10819:
URL: https://github.com/apache/seatunnel/issues/10819
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues.
### What happened
When SeaTunnel reads ORC files, if a column is of BINARY type, the original binary data gets completely corrupted.
The root cause is located in the readBytesVal method of OrcReadStrategy. Currently, it forcefully converts the raw byte array into a String and then back to bytes:
`bytesObj = this.bytesVectorToString(bytesVector, rowNum, charset);
if (typeDescription.getCategory() == TypeDescription.Category.BINARY && bytesObj != null) {
bytesObj = ((String) bytesObj).getBytes(charset);
}`
When a raw binary byte array (which doesn't conform to UTF-8 rules) is forced into a String, Java automatically replaces the invalid bytes with the Unicode Replacement Character \uFFFD. When this String is converted back to bytes via .getBytes(), those replacement characters become a fixed sequence of [-17, -65, -67] (which is EF BF BD in Hex).
As shown in the logs below, the original binary payload is overwritten by massive repeated patterns of -17, -65, -67, causing irreversible data corruption.
### SeaTunnel Version
2.3.12
### SeaTunnel Config
```conf
{
"env": {
"execution.parallelism": "1",
"job.name": "debug_hive_source_to_console"
},
"source": [
{
"plugin_name": "Hive",
"result_table_name": "source_data",
"metastore_uri": "thrift://<masked>",
"table_name": "default.test"
}
],
"sink": [
{
"plugin_name": "Console",
"source_table_name": "source_data"
}
]
}
```
### Running Command
```shell
${SPARK_HOME}/bin/spark-submit \
--class "org.apache.seatunnel.core.starter.spark.SeaTunnelSpark" \
--name "SeaTunnel" \
--master "yarn" \
--deploy-mode "client" \
/data01/apache-seatunnel-2.3.12-SNAPSHOT/starter/seatunnel-spark-2-starter.jar \
--config "test.json"
```
### Error Exception
```log
26/04/24 18:06:57 INFO ReaderImpl: Reading ORC rows from hdfs://130cluster/apps/hive/warehouse/test.db/sink_norm/part-00000-c471ade5-0193-4412-af02-33d58208de49-c000.snappy.orc with {include: null, offset: 0, length: 9223372036854775807, schema: struct<pk:string,payload:binary>, includeAcidColumns: true}
26/04/24 18:06:57 INFO ConsoleSinkWriter: subtaskIndex=0 rowIndex=1: SeaTunnelRow#tableId=test.sink_norm SeaTunnelRow#kind=INSERT : S_S_CUSTNO=cust_0001, [84, 68, 80, 76, 0, 1, 0, 0, 0, 0, 0, 20, 83, 95, 83, 95, 67, 85, 83, 84, 78, 79, 61, 99, 117, 115, 116, 95, 48, 48, 48, 49, 0, 0, 0, 4, 0, 0, 0, 6, 115, 117, 109, 49, 48, 48, 0, 0, 2, 72, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 16, 0, 0, 0, 0, 0, 10, 0, 14, 0, 6, 0, 13, 0, 8, 0, 10, 0, 0, 0, 0, 0, 4, 0, 16, 0, 0, 0, 0, 1, 10, 0, 12, 0, 0, 0, 8, 0, 4, 0, 10, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 108, 0, 0, 0, 24, 0, 0, 0, 0, 0, 18, 0, 24, 0, 20, 0, 19, 0, 18, 0, 12, 0, 0, 0, 8, 0, 4, 0, 18, 0, 0, 0, 20, 0, 0, 0, 20, 0, 0, 0, 28, 0, 0, 0, 0, 0, 3, 1, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 8, 0, 6, 0, 6, 0, 0, 0, 0, 0, 2, 0, 6, 0, 0, 0, 115, 117, 109, 49, 48, 48, 0, 0, 0, 0, 18, 0, 24, 0, 20, 0, 0, 0, 19, 0, 12, 0, 0, 0, 8, 0, 4, 0, 18, 0, 0, 0, 20, 0, 0, 0,
20, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 2, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 12, 0, 8, 0, 7, 0, 8, 0, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 2, 0, 0, 0, 116, 107, 0, 0, 0, 0, 0, 0, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 12, 0, 22, 0, 14, 0, 21, 0, 16, 0, 4, 0, 12, 0, 0, 0, -17, -65, -67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 16, 0, 0, 0, 0, 3, 10, 0, 24, 0, 12, 0, 8, 0, 4, 0, 10, 0, 0, 0, 20, 0, 0, 0, 88, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -17, -65, -67, 0, 0, 0, 0, 0, 0, 0, 0, 69, 96, 105, 0, 0, 0, 0, -17, -65, -67, -17, -65, -67, 97, 105, 0, 0, 0, 0, -17, -65, -67, 34, 108, 105, 0, 0, 0,
0, 0, -17, -65, -67, 114, 105, 0, 0, 0, 0, -17, -65, -67, 82, -17, -65, -67, 105, 0, 0, 0, 0, -17, -65, -67, -17, -65, -67, -17, -65, -67, 105, 0, 0, 0, 0, -17, -65, -67, -17, -65, -67, -17, -65, -67, 105, 0, 0, 0, 0, -17, -65, -67, 106, -17, -65, -67, 105, 0, 0, 0, 0, -17, -65, -67, 0, 0, 0, 0, 0, 0, 0, -17, -65, -67, 112, 61, 10, -17, -65, -67, 85, -17, -65, -67, 64, 102, 102, 102, 102, -26, -108, -93, 64, 102, 102, 102, 102, 102, 66, -17, -65, -67, 64, -17, -65, -67, -17, -65, -67, -17, -65, -67, 40, 92, -17, -65, -67, -17, -65, -67, 64, 72, -17, -65, -67, 122, 20, -17, -65, -67, 69, -17, -65, -67, 64, 51, 51, 51, 51, -17, -65, -67, 77, -17, -65, -67, 64, -41, -93, 112, 61, -17, -65, -67, 107, -17, -65, -67, 64, 61, 10, -41, -93, -17, -65, -67, 64, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 0, 0, 0, 0, 6, 115, 117, 109, 49, 48, 54, 0, 0, 1, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 16, 0, 0, 0, 0,
0, 10, 0, 14, 0, 6, 0, 13, 0, 8, 0, 10, 0, 0, 0, 0, 0, 4, 0, 16, 0, 0, 0, 0, 1, 10, 0, 12, 0, 0, 0, 8, 0, 4, 0, 10, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 108, 0, 0, 0, 24, 0, 0, 0, 0, 0, 18, 0, 24, 0, 20, 0, 19, 0, 18, 0, 12, 0, 0, 0, 8, 0, 4, 0, 18, 0, 0, 0, 20, 0, 0, 0, 20, 0, 0, 0, 28, 0, 0, 0, 0, 0, 3, 1, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 8, 0, 6, 0, 6, 0, 0, 0, 0, 0, 2, 0, 6, 0, 0, 0, 115, 117, 109, 49, 48, 54, 0, 0, 0, 0, 18, 0, 24, 0, 20, 0, 0, 0, 19, 0, 12, 0, 0, 0, 8, 0, 4, 0, 18, 0, 0, 0, 20, 0, 0, 0, 20, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 2, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 12, 0, 8, 0, 7, 0, 8, 0, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 2, 0, 0, 0, 116, 107, 0, 0, 0, 0, 0, 0, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 12, 0, 22, 0, 14, 0, 21, 0, 16, 0, 4, 0, 12, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 16, 0, 0, 0, 0, 3, 10, 0, 24, 0, 12, 0, 8, 0, 4, 0, 10, 0, 0, 0, 20,
0, 0, 0, 88, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, -17, -65, -67, -17, -65, -67, 97, 105, 0, 0, 0, 0, 0, -17, -65, -67, 114, 105, 0, 0, 0, 0, -17, -65, -67, 82, -17, -65, -67, 105, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 102, 102, 102, 102, -26, -108, -93, 64, -17, -65, -67, -17, -65, -67, -17, -65, -67, 40, 92, -17, -65, -67, -17, -65, -67, 64, 72, -17, -65, -67, 122, 20, -17, -65, -67, 69, -17, -65, -67, 64, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 0, 0, 0, 0, 6, 115, 117, 109, 49, 48, 53, 0, 0, 1, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 16, 0, 0,
0, 0, 0, 10, 0, 14, 0, 6, 0, 13, 0, 8, 0, 10, 0, 0, 0, 0, 0, 4, 0, 16, 0, 0, 0, 0, 1, 10, 0, 12, 0, 0, 0, 8, 0, 4, 0, 10, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 108, 0, 0, 0, 24, 0, 0, 0, 0, 0, 18, 0, 24, 0, 20, 0, 19, 0, 18, 0, 12, 0, 0, 0, 8, 0, 4, 0, 18, 0, 0, 0, 20, 0, 0, 0, 20, 0, 0, 0, 28, 0, 0, 0, 0, 0, 3, 1, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 8, 0, 6, 0, 6, 0, 0, 0, 0, 0, 2, 0, 6, 0, 0, 0, 115, 117, 109, 49, 48, 53, 0, 0, 0, 0, 18, 0, 24, 0, 20, 0, 0, 0, 19, 0, 12, 0, 0, 0, 8, 0, 4, 0, 18, 0, 0, 0, 20, 0, 0, 0, 20, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 2, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 12, 0, 8, 0, 7, 0, 8, 0, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 2, 0, 0, 0, 116, 107, 0, 0, 0, 0, 0, 0, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 12, 0, 22, 0, 14, 0, 21, 0, 16, 0, 4, 0, 12, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 16, 0, 0, 0, 0, 3, 10, 0, 24, 0, 12, 0, 8, 0, 4, 0, 10, 0, 0,
0, 20, 0, 0, 0, 88, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 111, -17, -65, -67, 104, 0, 0, 0, 0, 0, -17, -65, -67, 85, 105, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, -17, -65, -67, 30, -17, -65, -67, -17, -65, -67, -17, -65, -67, -35, -90, 64, 92, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 38, -17, -65, -67, 64, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 0, 0, 0, 0, 6, 115, 117, 109, 49, 48, 51, 0, 0, 1, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 16, 0, 0, 0, 0, 0, 10, 0, 14, 0, 6, 0, 13, 0, 8, 0, 10, 0, 0, 0, 0, 0, 4, 0, 16, 0, 0, 0, 0,
1, 10, 0, 12, 0, 0, 0, 8, 0, 4, 0, 10, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 108, 0, 0, 0, 24, 0, 0, 0, 0, 0, 18, 0, 24, 0, 20, 0, 19, 0, 18, 0, 12, 0, 0, 0, 8, 0, 4, 0, 18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, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -17, -65, -67, 112, -17, -65, -67, 105, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -17, -65, -67, 112, 61, 10, -17, -65, -67, 92, -17, -65, -67, 64, -17, -65, -67, -17, -65, -67, -17, -65, -67, -17, -65, -67, 0, 0, 0, 0]
...
```
### Zeta or Flink or Spark Version
Spark 3.3.4 (However, since this is a SeaTunnel connector v2 bug, it affects all engines including Zeta and Flink).
### Java or Scala Version
java8, scala2.12.15
### Screenshots
_No response_
### Are you willing to submit PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
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: commits-unsubscribe@seatunnel.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [Connector-V2] ORC Source reader corrupts BINARY/BYTES data due to forced String casting [seatunnel]
Posted by "corgy-w (via GitHub)" <gi...@apache.org>.
corgy-w closed issue #10819: [Bug] [Connector-V2] ORC Source reader corrupts BINARY/BYTES data due to forced String casting
URL: https://github.com/apache/seatunnel/issues/10819
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] [Connector-V2] ORC Source reader corrupts BINARY/BYTES data due to forced String casting [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10819:
URL: https://github.com/apache/seatunnel/issues/10819#issuecomment-4320996132
Thanks for the detailed report and code pointer.
I checked the current ORC read path and this does look like a real bug. In `OrcReadStrategy#readBytesVal()`, the `BINARY` branch first converts the raw ORC bytes to a `String` via `bytesVectorToString(...)` and only then converts that string back to bytes. That is acceptable for text data, but not for arbitrary binary payloads, so the corruption pattern you showed is consistent with the current implementation.
This should be handled as a raw byte path for ORC `BINARY`, not a charset round-trip. Since this logic sits in the shared file connector reader, it is also reasonable to treat it as affecting every engine that uses this reader path, not just Spark.
If you would like to open a PR, a good regression guard would be an ORC read test that asserts byte-for-byte round-trip for a non-UTF-8 payload. This issue is worth keeping open for follow-up.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org