Github user jinfengni commented on a diff in the pull request:

    https://github.com/apache/drill/pull/377#discussion_r53527480
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillFuncHolder.java 
---
    @@ -264,7 +265,24 @@ public boolean isFieldReader(int i) {
         return this.parameters[i].isFieldReader;
       }
     
    -  public MajorType getReturnType(List<LogicalExpression> args) {
    +  public static List<MajorType> getResultType(List<LogicalExpression> 
expressions) {
    +    final List<MajorType> argumentTypes = Lists.newArrayList();
    +    for (LogicalExpression expression : expressions) {
    +      argumentTypes.add(expression.getMajorType());
    +    }
    +    return argumentTypes;
    +  }
    +
    +  public final MajorType getReturnTypeMajorType(final List<MajorType> 
types) {
    +    final List<LogicalExpression> expressions = Lists.newArrayList();
    +    for(final MajorType type : types) {
    +      final LogicalExpression dumbExpr = new DumbLogicalExpression(type);
    --- End diff --
    
    In stead of creating a DumbLogicalExpression augmented with type, it's 
better to do the opposite way.  Slightly modify the original one such that it 
accepts a list of MajorTypes. It only requires to know the argument type, to 
decide the return type. 
    
    MajorType getReturnTypeMajorType(final List<MajorType> types) : This one 
uses most part of original implementation.
    
    MajorType getReturnType(List<LogicalExpression> expressions) : this one 
will pass in the list of argument types and then call the first one. 
     
    



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to