[ 
https://issues.apache.org/jira/browse/TAJO-1946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15001765#comment-15001765
 ] 

ASF GitHub Bot commented on TAJO-1946:
--------------------------------------

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

    https://github.com/apache/tajo/pull/839#discussion_r44626030
  
    --- Diff: 
tajo-core/src/main/java/org/apache/tajo/engine/planner/global/builder/DistinctGroupbyBuilder.java
 ---
    @@ -414,16 +414,15 @@ private DistinctGroupbyNode 
buildBaseDistinctGroupByNode(GlobalPlanContext conte
         for (DistinctGroupbyNodeBuildInfo buildInfo: 
distinctNodeBuildInfos.values()) {
           GroupbyNode eachGroupbyNode = buildInfo.getGroupbyNode();
           List<AggregationFunctionCallEval> groupbyAggFunctions = 
buildInfo.getAggFunctions();
    -      Target[] targets = new 
Target[eachGroupbyNode.getGroupingColumns().length + 
groupbyAggFunctions.size()];
    -      int targetIdx = 0;
    +      List<Target> targets = new ArrayList<>();
     
           for (Column column : eachGroupbyNode.getGroupingColumns()) {
    -        Target target = new Target(new FieldEval(column));
    -        targets[targetIdx++] = target;
    +        targets.add(new Target(new FieldEval(column)));
           }
           for (Target eachAggFunctionTarget: 
buildInfo.getAggFunctionTargets()) {
    -        targets[targetIdx++] = eachAggFunctionTarget;
    +        targets.add(eachAggFunctionTarget);
    --- End diff --
    
    You can simply use ```addAll()```.


> Change Projectable::setTargets and getTargets to set and get List<Target>
> -------------------------------------------------------------------------
>
>                 Key: TAJO-1946
>                 URL: https://issues.apache.org/jira/browse/TAJO-1946
>             Project: Tajo
>          Issue Type: Sub-task
>          Components: Planner/Optimizer
>            Reporter: Hyunsik Choi
>            Assignee: Dongkyu Hwangbo
>            Priority: Minor
>              Labels: newbie
>
> See TAJO-1938. It would simplify lots of codes for 'for-loop' on Targets if 
> we change {{Projectable::setTargets}} and {{getTargets}} to set and get 
> {{List<Target>}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to