This is an automated email from the ASF dual-hosted git repository.

arina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git


The following commit(s) were added to refs/heads/master by this push:
     new 83bc8e6  DRILL-7663: Code refactor to DefaultFunctionResolver
83bc8e6 is described below

commit 83bc8e63586051962a6ab39731d3c0ae19b334d1
Author: weijie.tong <weijie.t...@alipay.com>
AuthorDate: Wed Mar 25 20:00:44 2020 +0800

    DRILL-7663: Code refactor to DefaultFunctionResolver
---
 .../apache/drill/exec/resolver/DefaultFunctionResolver.java   | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/DefaultFunctionResolver.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/DefaultFunctionResolver.java
index b768792..ae3c68b 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/DefaultFunctionResolver.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/DefaultFunctionResolver.java
@@ -19,8 +19,7 @@ package org.apache.drill.exec.resolver;
 
 import java.util.LinkedList;
 import java.util.List;
-
-import org.apache.drill.shaded.guava.com.google.common.collect.Lists;
+import java.util.stream.Collectors;
 import org.apache.drill.common.expression.FunctionCall;
 import org.apache.drill.common.expression.LogicalExpression;
 import org.apache.drill.common.types.TypeProtos;
@@ -38,12 +37,10 @@ public class DefaultFunctionResolver implements 
FunctionResolver {
     int currcost = Integer.MAX_VALUE;
     DrillFuncHolder bestmatch = null;
     final List<DrillFuncHolder> bestMatchAlternatives = new LinkedList<>();
-
+    List<TypeProtos.MajorType> argumentTypes = call.args().stream()
+            .map(LogicalExpression::getMajorType)
+            .collect(Collectors.toList());
     for (DrillFuncHolder h : methods) {
-      final List<TypeProtos.MajorType> argumentTypes = Lists.newArrayList();
-      for (LogicalExpression expression : call.args()) {
-        argumentTypes.add(expression.getMajorType());
-      }
       currcost = TypeCastRules.getCost(argumentTypes, h);
 
       // if cost is lower than 0, func implementation is not matched, either 
w/ or w/o implicit casts

Reply via email to