You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/03/07 23:38:57 UTC

[GitHub] [incubator-druid] ferristseng commented on a change in pull request #7020: Write null byte when indexing numeric dimensions with Hadoop

ferristseng commented on a change in pull request #7020: Write null byte when indexing numeric dimensions with Hadoop
URL: https://github.com/apache/incubator-druid/pull/7020#discussion_r263615958
 
 

 ##########
 File path: indexing-hadoop/src/main/java/org/apache/druid/indexer/InputRowSerde.java
 ##########
 @@ -63,6 +64,35 @@
   private static final IndexSerdeTypeHelper FLOAT_HELPER = new FloatIndexSerdeTypeHelper();
   private static final IndexSerdeTypeHelper DOUBLE_HELPER = new DoubleIndexSerdeTypeHelper();
 
+  private static <T extends Number> void writeNullableNumeric(
+      T ret,
+      final ByteArrayDataOutput out,
+      final Supplier<T> getDefault,
+      final Consumer<T> write)
+  {
+    if (ret == null) {
+      ret = getDefault.get();
+    }
+
+    // Write the null byte only if the default numeric value is still null.
+    if (ret == null) {
+      out.writeByte(NullHandling.IS_NULL_BYTE);
+
 
 Review comment:
   Will do.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org