rubenada commented on code in PR #3311:
URL: https://github.com/apache/calcite/pull/3311#discussion_r1262268771
##########
core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java:
##########
@@ -117,6 +117,25 @@ Expression fieldReference(Expression expression, int field,
*/
Expression generateAccessor(List<Integer> fields);
+ /** Similar to {@link #generateAccessor(List)}, but if one of the fields is
<code>null</code>,
+ * it will return <code>null</code>.
+ *
+ * <p>For example:
+ *
+ * <blockquote><pre>
+ * new Function1<Employee, Object[]> {
+ * public Object[] apply(Employee v1) {
+ * return v1.<fieldN> == null
+ * ? null
+ * : v1.<fieldM> == null
+ * ? null
+ * : FlatLists.of(v1.<fieldN>, v1.<fieldM>);
+ * }
+ * }
+ * }</pre></blockquote>
+ */
+ Expression generateNullableAccessor(List<Integer> fields);
Review Comment:
Yes, agree. I struggled to find a name for the new method. My initial
thought was to name it "generateAccessorWithoutNulls" , which is a bit similar
to the one you propose, wdyt?
However, I also had the impression that "generateAccessorWithoutNulls" (or
"generateIgnoreNullAccessor" / "generateAccessorIgnoreNull") might give the
impression that null values will be skipped and not returned by the accessor,
and that is not the purpose of the method.
In any case, this is juts a detail that does not invalidate the fix, let's
try to find the most suitable (or at least the less confusing) name for the new
method, I'm totally open to suggestions (maybe some other reviewer will chime
in with other proposals).
--
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]