[
https://issues.apache.org/jira/browse/IMPALA-8026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16734354#comment-16734354
]
Tim Armstrong commented on IMPALA-8026:
---------------------------------------
Ok, I can reproduce the bug with this query (it could probably be simplified).
{noformat}
select count(*) from functional.alltypestiny t1 left outer join
functional.alltypestiny t2 on t1.id >= t2.id and t1.id <= t2.id + 10 where
t1.id < 1000
{noformat}
I added logging and could see the counter diverging from the actual rows
returned:
{noformat}
...
I0104 09:15:43.860461 29040 nested-loop-join-node.cc:644] Fall out 18
num_rows_returned_=18 counter=40
I0104 09:15:43.860464 29040 nested-loop-join-node.cc:601] FindBuildMatches() 18
I0104 09:15:43.860497 29040 nested-loop-join-node.cc:644] Fall out 25
num_rows_returned_=25 counter=65
I0104 09:15:43.860832 29040 nested-loop-join-node.cc:601] FindBuildMatches() 25
I0104 09:15:43.860867 29040 nested-loop-join-node.cc:644] Fall out 31
num_rows_returned_=31 counter=96
I0104 09:15:43.860870 29040 nested-loop-join-node.cc:601] FindBuildMatches() 31
I0104 09:15:43.860899 29040 nested-loop-join-node.cc:644] Fall out 36
num_rows_returned_=36 counter=132
{noformat}
I got thrown off the scent by looking at the summary of the final query, which
had the correct count. It turns out that ExecNode::Close() fixes the counter at
the end. So it's only the intermediate counts while the query is running that
will be off.
{code}
void ExecNode::Close(RuntimeState* state) {
if (is_closed_) return;
is_closed_ = true;
if (rows_returned_counter_ != NULL) {
COUNTER_SET(rows_returned_counter_, num_rows_returned_);
}
{code}
> Actual row counts for nested loop join are meaningless
> ------------------------------------------------------
>
> Key: IMPALA-8026
> URL: https://issues.apache.org/jira/browse/IMPALA-8026
> Project: IMPALA
> Issue Type: Bug
> Components: Backend
> Affects Versions: Impala 3.1.0
> Reporter: Paul Rogers
> Assignee: Tim Armstrong
> Priority: Major
>
> Consider this extract from a query plan:
> {noformat}
> Operator #Rows Est. #Rows
> --------------------------------------------------------------
> …
> | 10:HASH JOIN 9.53M 18.14K
> | |--19:EXCHANGE 1 1
> | | 00:SCAN HDFS 1 1
> | 06:NESTED LOOP JOIN 4.88B 863.84K
> | |--18:EXCHANGE 1 1
> | | 04:SCAN HDFS 1 1
> | 05:HASH JOIN 9.53M 863.84K
> {noformat}
> If the above is to be believed, the 06 nested loop join produced 5 billion
> rows. But, the actual number is far too huge for that: joining 1 row with 10
> million rows cannot produce 500 times that number of rows.
> It appears that the nested loop join actually processed and returned the 9.5
> million rows, since that is the same number produced by the 10 hash join
> which joins a single row with the output of the nested loop join.
> Because this same bogus result appears across multiple plans, it is likely
> that the actual number is completely wrong and bears no relation to the
> number of rows actually returned.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]