arina-ielchiieva commented on a change in pull request #1509: DRILL-6810: 
Disable NULL_IF_NULL NullHandling for functions with Comp…
URL: https://github.com/apache/drill/pull/1509#discussion_r227345538
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MappifyUtility.java
 ##########
 @@ -38,22 +38,29 @@
   public static final String fieldValue = "value";
 
   public static DrillBuf mappify(FieldReader reader, BaseWriter.ComplexWriter 
writer, DrillBuf buffer, String caller) {
-    // Currently we expect single map as input
-    if (DataMode.REPEATED == reader.getType().getMode() || 
!(reader.getType().getMinorType() == TypeProtos.MinorType.MAP)) {
+    // Currently we expect single map or null as input
+    if (reader.getType().getMode() == DataMode.REPEATED
+        || (reader.isSet() && reader.getType().getMinorType() != 
TypeProtos.MinorType.MAP)) {
       throw new DrillRuntimeException("kvgen function only supports Simple 
maps as input");
     }
     BaseWriter.ListWriter listWriter = writer.rootAsList();
     listWriter.startList();
     BaseWriter.MapWriter mapWriter = listWriter.map();
 
+    if (!reader.isSet()) {
 
 Review comment:
   We can init `BaseWriter.MapWriter mapWriter = listWriter.map();` after null 
check.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to