zachjsh commented on code in PR #13627:
URL: https://github.com/apache/druid/pull/13627#discussion_r1066344426


##########
server/src/main/java/org/apache/druid/catalog/model/CatalogUtils.java:
##########
@@ -93,15 +100,54 @@ public static <T> T safeCast(Object value, Class<T> type, 
String propertyName)
     catch (ClassCastException e) {
       throw new IAE("Value [%s] is not valid for property %s, expected type 
%s",
           value,
-          propertyName,
+          key,
           type.getSimpleName()
       );
     }
   }
 
-  public static <T> T safeGet(Map<String, Object> map, String propertyName, 
Class<T> type)
+  public static <T> T safeGet(Map<String, Object> map, String key, Class<T> 
type)
   {
-    return safeCast(map.get(propertyName), type, propertyName);
+    return safeCast(map.get(key), type, key);
+  }
+
+  public static long getLong(Map<String, Object> map, String key)
+  {
+    Object value = map.get(key);
+    if (value == null) {
+      return 0;
+    }
+
+    // Jackson may deserialize the value as either Integer or Long.
+    if (value instanceof Integer) {
+      return (Integer) value;
+    }
+    return (Long) value;
+  }
+
+  public static String getString(Map<String, Object> map, String key)
+  {
+    return safeGet(map, key, String.class);
+  }
+
+  public static List<String> getStringList(Map<String, Object> map, String key)

Review Comment:
   this isnt used.



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