[
https://issues.apache.org/jira/browse/TAJO-1659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14600414#comment-14600414
]
ASF GitHub Bot commented on TAJO-1659:
--------------------------------------
Github user hyunsik commented on a diff in the pull request:
https://github.com/apache/tajo/pull/612#discussion_r33211777
--- Diff:
tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java
---
@@ -228,26 +237,15 @@ public Tuple next() throws IOException {
return null;
}
- Tuple tuple;
- Tuple outTuple = new VTuple(outColumnNum);
-
- if (!plan.hasQual()) {
- if ((tuple = scanner.next()) != null) {
- projector.eval(tuple, outTuple);
- outTuple.setOffset(tuple.getOffset());
- return outTuple;
- } else {
- return null;
- }
- } else {
- while ((tuple = scanner.next()) != null) {
- if (qual.eval(tuple).isTrue()) {
- projector.eval(tuple, outTuple);
- return outTuple;
- }
- }
- return null;
+ while(scanIt.hasNext()) {
+ Tuple outTuple = new VTuple(outColumnNum);
--- End diff --
It is actually for every row. While condition is just for check if there is
next row, and every while loop will be just returned for each tuple.
> Simplify scan iteration in SeqScan
> ----------------------------------
>
> Key: TAJO-1659
> URL: https://issues.apache.org/jira/browse/TAJO-1659
> Project: Tajo
> Issue Type: Improvement
> Components: physical operator
> Reporter: Hyunsik Choi
> Assignee: Hyunsik Choi
> Fix For: 0.11.0
>
>
> SeqScanExec internally uses if-condition branch to perform filter iteration
> or full-scan iteration on a table. It is possible to cause branch
> misprediction. Also, this approach makes code messy. This patch introduce an
> scan iterator to simplify the if-condition branch.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)