Github user jinfengni commented on a diff in the pull request:
https://github.com/apache/drill/pull/906#discussion_r135974107
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
---
@@ -768,4 +765,73 @@ else if (exprHasPrefix && refHasPrefix) {
}
}
}
+
+ /**
+ * handle FAST NONE specially when Project for query output. This
happens when input returns a
+ * FAST NONE directly ( input does not return any batch with
schema/data).
+ *
+ * Project operator has to return a batch with schema derived using the
following 3 rules:
+ * Case 1: * ==> expand into an empty list of columns.
+ * Case 2: regular column reference ==> treat as nullable-int column
+ * Case 3: expressions => Call ExpressionTreeMaterialization over an
empty vector contain.
--- End diff --
I managed to find a way to share the existing code path. With the revised
patch, both of the first scenario and second one would call same method to
setup a new schema based on incoming batch. The only difference for the second
scenario is we have to simulate a record batch with empty vector container, as
the code for set up new schema requires it. That is done by leveraging an
existing class (with some extension).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---