jerryshao commented on code in PR #14374:
URL: https://github.com/apache/gravitino/pull/14374#discussion_r4421053519


##########
common/build.gradle.kts:
##########
@@ -38,6 +38,7 @@ dependencies {
   implementation(libs.jackson.datatype.jdk8)
   implementation(libs.jackson.datatype.jsr310)
   implementation(libs.jackson.databind)
+  implementation(libs.jackson.dataformat.yaml)

Review Comment:
   Adding `jackson-dataformat-yaml` as `implementation` here makes every 
consumer of `common` bundle it. I built 
`:clients:client-java-runtime:shadowJar` from this head: Jackson YAML is 
relocated under `org.apache.gravitino.shaded.com.fasterxml`, but 
`org.yaml.snakeyaml` is not relocated (262 classes plus `META-INF/versions/9`), 
and the relocated `YAMLFactory` still references `org/yaml/snakeyaml/*`. This 
ends up in the Spark, Flink, Trino and filesystem-hadoop3 runtimes and in 
`maintenance:jobs`, where Spark, Hadoop and Flink often ship their own 
SnakeYAML, so we risk class clashes and version skew. The generated runtime 
`META-INF/LICENSE` also lists jackson-dataformat-yaml but not SnakeYAML, 
because the SnakeYAML jar has no LICENSE file and 
`dev/release/maven/dependencies.txt` has no entry for it.
   
   Since no client code uses the converter yet, could we make this 
`compileOnly` in `common` and declare it only where it is needed (core already 
has it)? If clients do need it, please add `relocate("org.yaml.snakeyaml", 
"org.apache.gravitino.shaded.org.yaml.snakeyaml")` to client-java-runtime and 
maintenance:jobs, plus a SnakeYAML license entry in `dependencies.txt`.



##########
common/src/main/java/org/apache/gravitino/semantic/OssieDocumentConverter.java:
##########
@@ -747,7 +765,7 @@ private static void stashProperties(ObjectNode root, 
Map<String, String> propert
   private static Map<String, String> extractProperties(ObjectNode root) {
     JsonNode extensionsNode = root.get("custom_extensions");
     if (!(extensionsNode instanceof ArrayNode)) {
-      return Map.of();
+      return new LinkedHashMap<>();

Review Comment:
   nit: The only caller (line 266) already copies this into a new 
`LinkedHashMap`, so `Collections.emptyMap()` or `ImmutableMap.of()` would keep 
the original "no allocation, immutable" intent.



##########
common/src/main/java/org/apache/gravitino/semantic/OssieDocumentConverter.java:
##########
@@ -507,18 +513,30 @@ private static DataType readDataType(ObjectNode object, 
String path) {
   }
 
   private static String dataTypeName(DataType dataType) {
-    return switch (dataType) {
-      case STRING -> "String";
-      case INTEGER -> "Integer";
-      case DECIMAL -> "Decimal";
-      case FLOAT -> "Float";
-      case BOOLEAN -> "Boolean";
-      case DATE -> "Date";
-      case TIME -> "Time";
-      case DATE_TIME -> "DateTime";
-      case DATE_TIME_TZ -> "DateTimeTz";
-      case OPAQUE -> "Opaque";
-    };
+    switch (dataType) {
+      case STRING:
+        return "String";
+      case INTEGER:
+        return "Integer";
+      case DECIMAL:
+        return "Decimal";
+      case FLOAT:
+        return "Float";
+      case BOOLEAN:
+        return "Boolean";
+      case DATE:
+        return "Date";
+      case TIME:
+        return "Time";
+      case DATE_TIME:
+        return "DateTime";
+      case DATE_TIME_TZ:
+        return "DateTimeTz";
+      case OPAQUE:
+        return "Opaque";
+      default:

Review Comment:
   nit: The switch expression used to fail compilation when a new `DataType` 
value was added. With the Java 8 `default` branch that becomes a runtime 
`IllegalArgumentException`. Could we add a small test that exports a field for 
every `DataType.values()` so a missing mapping is caught early?



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