Kafka Connect: UUID columns fail to write with Parquet (ClassCastException)
- Dominant language
- Java
- Stars
- 9.2k
- Forks
- 3.5k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 129
Description
**Apache Iceberg version**
main @ 49b89a8c5
**Query engine**
Kafka Connect (N/A — not Spark/Flink)
**Please describe the bug**
`RecordConverter.convertUUID()` (`kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/RecordConverter.java` line 508) converts UUID values to `byte[]` when the target file format is Parquet. The Parquet UUID writer, `ParquetValueWriters.uuids()` (via `BaseParquetWriter`'s default visitor), expects a `java.util.UUID` and converts to bytes internally, so a `byte[]` fails to cast during write. ORC (`GenericOrcWriters.uuids()`) and Avro both write `UUID` directly — only the Parquet branch in `convertUUID` diverges from this.
**Steps to reproduce**
Sink a record with a UUID field to an Iceberg table using the default file format (Parquet). `IcebergWriter.convertToRow()` calls `convertUUID()`, which returns `byte[]`; the Parquet writer stack then throws on write.
Expected: the record writes successfully.
Actual: `ClassCastException: class [B cannot be cast to class java.util.UUID`.
**Additional context**
The `byte[]` conversion matched the Parquet writer contract before PR #11904 ("Parquet: Add readers and writers for the internal object model", merged 2025-01-24) changed `ParquetValueWriters`' UUID writer to accept `UUID` directly. `kafka-connect` was never updated to follow, making this a regression from that writer-contract change.
Contributor guide
Research direction
Start in kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/RecordConverter.java at convertUUID() and compare its Parquet branch with ParquetValueWriters.uuids() and the ORC/Avro handling described in the issue. Reproduce the default-Parquet UUID sink case and verify that the record writes successfully without the ClassCastException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100