MeihanLi commented on PR #17177:
URL: https://github.com/apache/pinot/pull/17177#issuecomment-3544143207

   Thanks @kishoreg for the comment.
   
   Some examples for IN clause below. You can also check 
QueryFingerprintUtilsTest.java and QueryFingerprintVisitorTest.java for more 
query examples including both Single Stage query and MSE queries.
   ```
   "SELECT col1 FROM table1 WHERE col2 IN (100, 200, 300)" 
   => "SELECT `col1` FROM `table1` WHERE `col2` IN (?, ?, ?)"
   "SELECT col1 FROM table1 WHERE col2 IN (SELECT col2 FROM table2 WHERE col3 = 
100)" 
   => "SELECT `col1` FROM `table1` WHERE `col2` IN (SELECT `col2` FROM `table2` 
WHERE `col3` = ?)"
   ```
   
   Regarding plan caching by fingerprint: 
   Literals are currently baked directly into the plan (e.g., 
RexExpression.Literal, FilterNode, DispatchableSubPlan), so we can’t substitute 
them at execution time. To reuse a plan with different literals, we’d need to 
clone the entire tree and rewrite all literal-bearing nodes. We also can’t 
safely cache post-optimization plans because many rules are literal-dependent 
(constant folding, dead-code elimination, etc.), and reusing an optimized plan 
with different literal values can yield incorrect results.
   
   Caching at the pre-optimization RelRoot level is possible, but it only skips 
validation + conversion. The expensive optimization phase would still run for 
each query.
   
   Given that, fingerprints are most useful today for metrics, logging, and 
identifying common patterns. If we see strong demand, we could start by caching 
plans for identical queries before taking on the bigger architectural change 
required for true parameterized plan caching.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to