kbuci commented on code in PR #18539:
URL: https://github.com/apache/hudi/pull/18539#discussion_r3246021734
##########
hudi-flink-datasource/hudi-flink2.1.x/src/main/java/org/apache/hudi/adapter/DataTypeAdapter.java:
##########
@@ -25,11 +25,46 @@
import org.apache.flink.table.types.logical.LogicalTypeRoot;
import org.apache.flink.types.variant.BinaryVariant;
import org.apache.flink.types.variant.Variant;
+import org.apache.hudi.common.util.Option;
+import org.apache.parquet.schema.LogicalTypeAnnotation;
+
+import java.lang.reflect.Method;
/**
* Adapter utils to provide {@code DataType} utilities.
*/
public class DataTypeAdapter {
+
+ /**
+ * The Parquet Variant binary format specification version passed to
+ * {@code LogicalTypeAnnotation.variantType(byte)}. Version 1 is the initial
spec
+ * defined by the Parquet Variant proposal (parquet-format 2.11.0 /
parquet-java 1.16.0).
+ */
+ private static final byte VARIANT_SPEC_VERSION = 1;
+
+ /**
+ * Cached VARIANT annotation resolved via reflection. Empty if parquet-java
+ * on the classpath predates {@code LogicalTypeAnnotation.variantType()} (<
1.16.0).
+ */
+ private static final Option<LogicalTypeAnnotation> VARIANT_ANNOTATION =
resolveVariantAnnotation();
+
+ private static Option<LogicalTypeAnnotation> resolveVariantAnnotation() {
+ try {
+ Method factory = LogicalTypeAnnotation.class.getMethod("variantType",
byte.class);
Review Comment:
Hmm when I had started working on this PR I thought 1.15.2+ had the
annotation/method but when I saw changelogs it seems that its only in 1.16?
https://github.com/apache/parquet-java/releases/tag/apache-parquet-1.15.2
I even tried updating my PR to directly call the method, and it seems to be
getting error
```
/hudi/hudi-flink-datasource/hudi-flink2.1.x/src/main/java/org/apache/hudi/adapter/DataTypeAdapter.java:[42,28]
cannot find symbol
symbol: method variantType(byte)
location: class org.apache.parquet.schema.LogicalTypeAnnotation
```
https://github.com/apache/hudi/actions/runs/25897566102/job/76113762689?pr=18539#step:5:825
--
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]