jonvex commented on code in PR #13711:
URL: https://github.com/apache/hudi/pull/13711#discussion_r2364525385


##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroWrapperUtils.java:
##########
@@ -238,4 +234,120 @@ private static Pair<Boolean, String> 
getIsValueWrapperObfuscated(Object statsVal
     }
     return Pair.of(false, null);
   }
+
+  public enum PrimitiveWrapperType {
+    V1(Object.class, HoodieAvroWrapperUtils::wrapValueIntoAvro, 
HoodieAvroWrapperUtils::unwrapAvroValueWrapper, GenericRecord.class),
+    NULL(Void.class, HoodieAvroWrapperUtils::wrapNull, 
HoodieAvroWrapperUtils::unwrapNull, Void.class),
+    BOOLEAN(Boolean.class, HoodieAvroWrapperUtils::wrapBoolean, 
HoodieAvroWrapperUtils::unwrapBoolean, BooleanWrapper.class),
+    INT(Integer.class, HoodieAvroWrapperUtils::wrapInt, 
HoodieAvroWrapperUtils::unwrapInt, IntWrapper.class),
+    LONG(Long.class, HoodieAvroWrapperUtils::wrapLong, 
HoodieAvroWrapperUtils::unwrapLong, LongWrapper.class),
+    FLOAT(Float.class, HoodieAvroWrapperUtils::wrapFloat, 
HoodieAvroWrapperUtils::unwrapFloat, FloatWrapper.class),
+    DOUBLE(Double.class, HoodieAvroWrapperUtils::wrapDouble, 
HoodieAvroWrapperUtils::unwrapDouble, DoubleWrapper.class),
+    STRING(String.class, HoodieAvroWrapperUtils::wrapString, 
HoodieAvroWrapperUtils::unwrapString, StringWrapper.class),
+    BYTES(ByteBuffer.class, HoodieAvroWrapperUtils::wrapBytes, 
HoodieAvroWrapperUtils::unwrapBytes, BytesWrapper.class);
+
+    private final Class<?> clazz;
+    private final Function<Comparable<?>, Object> wrapper;
+    private final Function<Object, Comparable<?>> unwrapper;
+    private final Class<?> wrapperClass;
+
+    PrimitiveWrapperType(Class<?> clazz, Function<Comparable<?>, Object> 
wrapper, Function<Object, Comparable<?>> unwrapper, Class<?> wrapperClass) {
+      this.clazz = clazz;
+      this.wrapper = wrapper;
+      this.unwrapper = unwrapper;
+      this.wrapperClass = wrapperClass;
+    }
+
+    public Class<?> getClazz() {
+      return clazz;
+    }
+
+    public Object wrap(Comparable<?> value) {
+      return wrapper.apply(value);
+    }
+
+    public Comparable<?> unwrap(Object value) {
+      return unwrapper.apply(value);
+    }
+
+    public Class<?> getWrapperClass() {
+      return wrapperClass;
+    }
+  }
+
+  private static Object wrapNull(Comparable<?> value) {
+    return value;

Review Comment:
   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