Quanlong Huang has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/23566 )

Change subject: IMPALA-14065: Support WHERE clause in SHOW PARTITIONS statement
......................................................................


Patch Set 7:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/23566/7/fe/src/main/java/org/apache/impala/analysis/ShowStatsStmt.java
File fe/src/main/java/org/apache/impala/analysis/ShowStatsStmt.java:

http://gerrit.cloudera.org:8080/#/c/23566/7/fe/src/main/java/org/apache/impala/analysis/ShowStatsStmt.java@168
PS7, Line 168:
nit: The following new code makes the analyze() method too long now (>100 
lines). Please extract the new code into a new method, e.g. 
analyzeWhereClause().


http://gerrit.cloudera.org:8080/#/c/23566/7/fe/src/main/java/org/apache/impala/analysis/ShowStatsStmt.java@231
PS7, Line 231:                 analyzer, new ArrayList<>(conjuncts), true, 
tableRef);
HdfsPartitionPruner could skip some expressions in partition prunning and 
return more results. It's OK in SELECT queries since they will be finally 
filtered out in backend execution. But here we are using it for the final 
results. We need to deal with such cases.
Here are some problematic examples:

 show partitions functional.alltypes where month = rand();
 show partitions functional.alltypes where month > length(uuid());

rand() is always smaller than 1 so no partitions should be selected. length of 
uuid() is always 36 so no partitions should be selected. Currently all 
partitions are returned.

If we can't guarantee HdfsPartitionPruner executes all the conjuncts, we might 
need to generate a query plan to execute them in backend. Similar to queries 
like

 select year, month from functional.alltypes where month = rand();
 select year, month from functional.alltypes where month > length(uuid());

I think we can focus on guaranteeing HdfsPartitionPruner executes all the 
conjuncts first, e.g. for UDFs with constant parameters, always replace them as 
constant. They are other cases in HdfsPartitionPruner#prunePartitions() that we 
need to exame.



--
To view, visit http://gerrit.cloudera.org:8080/23566
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I2e2a14aabcea3fb17083d4ad6f87b7861113f89e
Gerrit-Change-Number: 23566
Gerrit-PatchSet: 7
Gerrit-Owner: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Pranav Lodha <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Riza Suminto <[email protected]>
Gerrit-Reviewer: Surya Hebbar <[email protected]>
Gerrit-Comment-Date: Mon, 17 Nov 2025 08:13:56 +0000
Gerrit-HasComments: Yes

Reply via email to