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

    https://github.com/apache/tajo/pull/454#discussion_r28204322
  
    --- Diff: 
tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/WindowAggExec.java
 ---
    @@ -301,30 +301,327 @@ private void evaluationWindowFrame() {
         }
     
         for (int idx = 0; idx < functions.length; idx++) {
    +      comp = null;
           if (orderedFuncFlags[idx]) {
    -        comp = new BaseTupleComparator(inSchema, 
functions[idx].getSortSpecs());
    -        Collections.sort(accumulatedInTuples, comp);
    -        comp = new BaseTupleComparator(schemaForOrderBy, 
functions[idx].getSortSpecs());
    +        SortSpec[] sortSpecs = functions[idx].getSortSpecs();
    +        comp = new BaseTupleComparator(schemaForOrderBy, sortSpecs);
             Collections.sort(evaluatedTuples, comp);
    +        // following comparator is used later when RANGE unit is handled 
to check whether order by value is changed or not
    +        comp = new BaseTupleComparator(inSchema, sortSpecs);
    +        Collections.sort(accumulatedInTuples, comp);
           }
     
    -      for (int i = 0; i < accumulatedInTuples.size(); i++) {
    -        Tuple inTuple = accumulatedInTuples.get(i);
    -        Tuple outTuple = evaluatedTuples.get(i);
    +      LogicalWindowSpec.LogicalWindowFrame.WindowFrameType windowFrameType 
= functions[idx].getLogicalWindowFrame().getFrameType();
    +      WindowSpec.WindowFrameUnit windowFrameUnit = 
functions[idx].getLogicalWindowFrame().getFrameUnit();
    +      int frameStart = 0, frameEnd = accumulatedInTuples.size() - 1;
    +      int startOffset = 
functions[idx].getLogicalWindowFrame().getStartBound().getNumber();
    +      int endOffset = 
functions[idx].getLogicalWindowFrame().getEndBound().getNumber();
    +      functions[idx].bind(inSchema);
    --- End diff --
    
    bind() is to prepare the function evaluation. Thus, it should be called 
once before evaluation.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to