Admaing commented on issue #18527:
URL: https://github.com/apache/iceberg/issues/18527#issuecomment-6915750102

   Thanks for the report — confirmed on current main.
   
   `RowDataWrapper.buildGetter` returns `null` for VARIANT, so the fallback 
`RowDataFieldGetter` hands back Flink's `BinaryVariant`, and 
`StructLike#get(pos, Variant.class)` then throws `ClassCastException: Cannot 
cast org.apache.flink.types.variant.BinaryVariant to 
org.apache.iceberg.variants.Variant`. Same root cause as #18504 for ARRAY, but 
a separate code path.
   
   I have a fix ready: a `case VARIANT` branch in `RowDataWrapper.buildGetter` 
that converts `BinaryVariant` into Iceberg's `Variant` by rebuilding the 
metadata and value buffers, in the same way `FlinkParquetWriters.VariantWriter` 
already does in the opposite direction. It applies to the Flink 2.2 and 2.3 
modules; 1.20 is left alone because Flink 1.20 has no VARIANT type.
   
   Test added: `TestRowDataWrapper#testVariant`, which round-trips a VARIANT 
value through `RowDataWrapper` and asserts the field name and value. It fails 
with the `ClassCastException` before the change and passes after. Both 
`iceberg-flink-2.2` and `iceberg-flink-2.3` test runs are green.
   
   Will open a PR shortly. @yusufyildiz34 since you reported this while working 
on #18508 — let me know if you're already on it, otherwise I'll submit mine.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to