gianm commented on a change in pull request #9111: Add HashJoinSegment, a 
virtual segment for joins.
URL: https://github.com/apache/druid/pull/9111#discussion_r365476534
 
 

 ##########
 File path: core/src/main/java/org/apache/druid/common/config/NullHandling.java
 ##########
 @@ -118,6 +118,27 @@ public static Double defaultDoubleValue()
     return replaceWithDefault() ? ZERO_DOUBLE : null;
   }
 
+  /**
+   * Returns the default value for an object of the provided class. Will be 
null in SQL-compatible null handling mode.
+   * May be null or some non-null default value when not in SQL-compatible 
null handling mode.
+   */
+  @Nullable
+  @SuppressWarnings("unchecked")
+  public static <T> T defaultValueForClass(final Class<T> clazz)
+  {
+    if (clazz == Float.class) {
+      return (T) defaultFloatValue();
+    } else if (clazz == Double.class) {
+      return (T) defaultDoubleValue();
+    } else if (clazz == Long.class) {
+      return (T) defaultLongValue();
+    } else if (clazz == String.class) {
+      return (T) defaultStringValue();
+    } else {
+      return null;
 
 Review comment:
   Unfortunately all types are supported. This method is used by the 
PossiblyNullColumnValueSelector when it generates nulls that don't exist in the 
base selector. The base selector could be returning any type, even weird ones 
that don't exist in Druid's type system (there's a COMPLEX catch-all for those, 
& it's used for stuff like sketches).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to