bbiiaaoo commented on code in PR #10637:
URL: https://github.com/apache/gravitino/pull/10637#discussion_r3042680669
##########
lance/lance-common/src/main/java/org/apache/gravitino/lance/common/utils/SerializationUtils.java:
##########
@@ -35,19 +35,19 @@ private SerializationUtils() {
// see
https://github.com/lancedb/lance-namespace/blob/2033b2fca126e87e56ba0d5ec19c5ec010c7a98f/
//
java/lance-namespace-core/src/main/java/com/lancedb/lance/namespace/rest/RestNamespace.java#L207-L208
public static Map<String, String> deserializeProperties(String
serializedProperties) {
- return StringUtils.isBlank(serializedProperties)
- ? ImmutableMap.of()
- : JsonUtil.parse(
- serializedProperties,
- jsonNode -> {
- Map<String, String> map = new HashMap<>();
- jsonNode
- .fields()
- .forEachRemaining(
- entry -> {
- map.put(entry.getKey(), entry.getValue().asText());
- });
- return map;
- });
+ if (StringUtils.isBlank(serializedProperties)) {
+ return new HashMap<>();
+ }
+
+ try {
+ Map<String, Object> rawProperties =
+ JsonUtils.anyFieldMapper()
+ .readValue(serializedProperties, new TypeReference<Map<String,
Object>>() {});
+ Map<String, String> deserializedProperties = new HashMap<>();
+ rawProperties.forEach((k, v) -> deserializedProperties.put(k,
String.valueOf(v)));
+ return deserializedProperties;
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Failed to deserialize table
properties JSON", e);
+ }
Review Comment:
Fixed
--
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]