paul-rogers commented on PR #12636:
URL: https://github.com/apache/druid/pull/12636#issuecomment-1157034550

   @clintropolis, thanks again for the description; it makes sense. 
@clintropolis described offline the process we use for parameters. Basically, 
when a query is to be run, and parameters provides along with the query text, 
`SqlParameterizerShuttle` substitutes in values early in the planing process 
for the reason @clintropolis outlines in the items linked above. 
`SqlParameterizerShuttle` may skip some parameters (such as `DATE` types with 
integer values) that it cannot handle.
   
   If the query comes via Avatica, and is a PREPARE, then there are no 
parameters values: parameters are left as placeholders with values to be filled 
in per-query.
   
   In either case, in the `plan()` step, any remaining parameters are replaced 
by values in `RelParameterizerShuttle`. This handles the case either of Avatica 
running a prepared query, or those pesky values which `SqlParameterizerShuttle` 
could not convert.
   
   Note also that in the query-with-parameters case, `SqlParameterizerShuttle` 
checked that values were provided. In the Avatica PREPARE case, there were no 
values, and `SqlParameterizerShuttle` wasn't called. In this case, it falls to 
`RelParameterizerShuttle` to do the check that the required values exist.
   
   As @clintropolis explained, the `RelParameterizerShuttle` check is only done 
for the "Druid convention" path. The "bindable convention" has its own 
parameter binding and checks.
   
   Given all this (and after a bit more code tweaking and comment-adding), the 
one-pass approach in this PR seems to handle all of the above paths through the 
planner. 


-- 
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