[
https://issues.apache.org/jira/browse/TAJO-1460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14386695#comment-14386695
]
ASF GitHub Bot commented on TAJO-1460:
--------------------------------------
Github user babokim commented on a diff in the pull request:
https://github.com/apache/tajo/pull/474#discussion_r27389087
--- Diff:
tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ExternalSortExec.java
---
@@ -168,7 +168,7 @@ private Path sortAndStoreChunk(int chunkId, List<Tuple>
tupleBlock)
int rowNum = tupleBlock.size();
long sortStart = System.currentTimeMillis();
- Collections.sort(tupleBlock, getComparator());
+ Iterable<Tuple> sorted = getSorter(tupleBlock).sort();
--- End diff --
appender should use this "sorted" instead of tupleBlock in the following
for statement.
```
for (Tuple t : sorted) { // tupleBlock -> sorted
appender.addTuple(t);
}
```
I was wonder how the code passed TestExternalSortExec. I found two reasons.
First, the above logic is not covered in current test condition. "numTuple"
in TestExternalSortExec code should be changed to "3000000" to cover more use
case.
Second, ProjectionExec is parent node in the test program.
ProjectionExec reuses the tuple object when next() is called. So
TestExternalSortExec code should be changed as the following:
```
while ((tuple = exec.next()) != null) {
...
//preVal = curVal;
preVal = new VTuple(curVal);
cnt++;
}
```
> Apply TAJO-1407 to ExternalSortExec
> -----------------------------------
>
> Key: TAJO-1460
> URL: https://issues.apache.org/jira/browse/TAJO-1460
> Project: Tajo
> Issue Type: Improvement
> Reporter: Navis
> Assignee: Navis
> Priority: Minor
>
> Tipped by @Hyoungjun Kim. Seemed possible to apply easily.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)