This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
The following commit(s) were added to refs/heads/master by this push:
new 92265e6f8 IMPALA-11829 - Fix bug in cardinality estimates related to
TABLE_NUM_ROWS hint
92265e6f8 is described below
commit 92265e6f81572fef09fbc2cf51174611dc1d788a
Author: David Rorke <[email protected]>
AuthorDate: Sat Jan 14 15:23:14 2023 -0800
IMPALA-11829 - Fix bug in cardinality estimates related to TABLE_NUM_ROWS
hint
IMPALA-7942 added support for a TABLE_NUM_ROWS query hint which can be used
to specify a table cardinality for cases where stats are missing or invalid.
In the case where stats were missing or invalid and no TABLE_NUM_ROWS hint
was specified
by the user, HdfsScanNode.getStatsNumRows was incorrectly returning a
default value of -1
instead of returning a rough estimate of cardinality as it had prior to the
IMPALA-7942 change.
This change fixes the return value of getStatsNumRows so it only uses the
TABLE_NUM_ROWS
value when the users has actually specified the query hint.
Change-Id: Ia27745fd93abd5dec99bf82f16899bd15a2b88ae
Reviewed-on: http://gerrit.cloudera.org:8080/19421
Reviewed-by: Qifan Chen <[email protected]>
Reviewed-by: wangsheng <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
b/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
index 51347d507..d638ea1a1 100644
--- a/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
@@ -1653,8 +1653,9 @@ public class HdfsScanNode extends ScanNode {
hasCorruptTableStats_ = true;
}
- // Use hint value if table no stats or stats is corrupt
- return numRows >= 0 && !hasCorruptTableStats_ ? numRows :tableNumRowsHint_;
+ // Use hint value if table no stats or stats is corrupt and hint is set
+ return (numRows >= 0 && !hasCorruptTableStats_) || tableNumRowsHint_ ==
-1L ?
+ numRows :tableNumRowsHint_;
}
/**