Csaba Ringhofer has posted comments on this change. ( http://gerrit.cloudera.org:8080/15250 )
Change subject: IMPALA-6689: Speed up point lookup for Kudu primary key ...................................................................... Patch Set 2: (7 comments) About the high level design: the primary key concept was also introduced for HDFS tables (IMPALA-3531) with the intention of helping the planner with better estimates. The same logic could be applied there too - the only difference is that it could only ensure that cardinality_ is <= 1, but would not affect input_cardinality_. I don't want to extend the scope here, but it may be useful to think about ways to generalize this logic. http://gerrit.cloudera.org:8080/#/c/15250/2//COMMIT_MSG Commit Message: http://gerrit.cloudera.org:8080/#/c/15250/2//COMMIT_MSG@13 PS2, Line 13: the nit: double the http://gerrit.cloudera.org:8080/#/c/15250/2//COMMIT_MSG@13 PS2, Line 13: set nit: sets http://gerrit.cloudera.org:8080/#/c/15250/2/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java File fe/src/main/java/org/apache/impala/planner/KuduScanNode.java: http://gerrit.cloudera.org:8080/#/c/15250/2/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java@288 PS2, Line 288: if (isPointLookupQuery_) { : inputCardinality_ = cardinality_ = 1; : } else { This looks correct with the exception of the case when the cardinality is 0. This can occur in two ways: - kuduTable_.getNumRows() returns 0 - the query has LIMIT 0 (don't ask me why is it useful, but it is valid SQL :) ), so capCardinalityAtLimit() will return 0 My suggestion is to only specialize the line with applyConjunctsSelectivity() for isPointLookupQuery_ http://gerrit.cloudera.org:8080/#/c/15250/2/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java@381 PS2, Line 381: c nit: capital C http://gerrit.cloudera.org:8080/#/c/15250/2/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java@394 PS2, Line 394: if (rpcTable.getSchema().getColumn(colName).isKey()) nit: it is a convention in Impala to add braces when an "if" + the statement do not fit to 1 line http://gerrit.cloudera.org:8080/#/c/15250/2/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java@400 PS2, Line 400: } A precondition with getPrimaryKeyColumnCount()>=1 would be nice here http://gerrit.cloudera.org:8080/#/c/15250/2/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java@401 PS2, Line 401: if (primaryKeyColInEquivalPred == rpcTable.getSchema().getPrimaryKeyColumnCount()) same as line 394 -- To view, visit http://gerrit.cloudera.org:8080/15250 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I4631cd4d1a528a1152b5cdcb268426f2ba1a0c08 Gerrit-Change-Number: 15250 Gerrit-PatchSet: 2 Gerrit-Owner: Wenzhe Zhou <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Quanlong Huang <[email protected]> Gerrit-Reviewer: Thomas Tauber-Marshall <[email protected]> Gerrit-Comment-Date: Thu, 20 Feb 2020 15:15:02 +0000 Gerrit-HasComments: Yes
