vvysotskyi commented on a change in pull request #1945: DRILL-7502: Invalid
codegen for typeof() with UNION
URL: https://github.com/apache/drill/pull/1945#discussion_r363376466
##########
File path:
logical/src/main/java/org/apache/drill/common/expression/FunctionHolderExpression.java
##########
@@ -21,31 +21,37 @@
import org.apache.drill.common.expression.fn.FuncHolder;
import org.apache.drill.common.expression.visitors.ExprVisitor;
-
import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableList;
-import org.apache.drill.shaded.guava.com.google.common.collect.Lists;
+/**
+ * Represents an actual call (a reference) to a declared function.
+ * Holds the name used (functions can have multiple aliases), the
+ * function declaration, and the actual argument expressions used
+ * in this call. This might be better named
+ * <code>FunctionCallExpression</code> as it represents a use
+ * of a function. Subclasses hold references to the declaration
+ * depending on the type (Drill, Hive) of the function.
+ */
public abstract class FunctionHolderExpression extends LogicalExpressionBase {
public final ImmutableList<LogicalExpression> args;
public final String nameUsed;
/**
- * A field reference identifies the output field and
- * is used to reference that field in the generated classes.
+ * Identifies the output field. References that field in the
+ * generated classes.
*/
private FieldReference fieldReference;
public FunctionHolderExpression(String nameUsed, ExpressionPosition pos,
List<LogicalExpression> args) {
super(pos);
+ this.nameUsed = nameUsed;
if (args == null) {
- args = Lists.newArrayList();
- }
-
- if (!(args instanceof ImmutableList)) {
- args = ImmutableList.copyOf(args);
+ this.args = ImmutableList.of();
+ } else if (args instanceof ImmutableList) {
Review comment:
Could you please replace these if blocks with `ImmutableList.copyOf`, it
produces these checks internally to avoid copying is possible.
----------------------------------------------------------------
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