[ 
https://issues.apache.org/jira/browse/CALCITE-6990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18041647#comment-18041647
 ] 

Alessandro Solimando edited comment on CALCITE-6990 at 11/30/25 3:55 PM:
-------------------------------------------------------------------------

If you had `WHERE colLeft > rand() AND colRight() > rand()` and you where to 
push the two subfilters to the two join operands, that would surely be a 
problem to me.

In your case, off the top of my head I can't see how this could change the 
semantics, but there might be corner cases I am not considering, but can we 
guarantee it won't be happening for wrong cases like the one I described?

How would other well-established databases act in this situation? I think it's 
safer to research what happens in Postgres etc. and conform to what they do in 
case the behavior is consistent.

If we are in doubt, it's safer not to push them down, correctness is always our 
primary goal.


was (Author: asolimando):
If you had `WHERE colLeft > rand() AND colRight() > rand()` and you where to 
push the two subfilters to the two join operands, that would surely be a 
problem to me.

In your case, off the top of my head I can't see how this could change the 
semantics, but there might be corner cases I am not considering, but can we 
guarantee it won't be happening for wrong cases like the one I described?

How would other well-established databases act in this situation? I think it's 
safer to research what happens in Postgres etc. and conform to what they do in 
case the behavior is consistent.



> Optimization passes should be checked for handling DynamicParameter
> -------------------------------------------------------------------
>
>                 Key: CALCITE-6990
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6990
>             Project: Calcite
>          Issue Type: Task
>          Components: core
>    Affects Versions: 1.39.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>
> Several PRs have fixed optimization passes which are wrong when queries can 
> contain dynamic parameters. Perhaps all of the passes should be audited with 
> this case in mind.
> See [CALCITE-6647] and [CALCITE-6983]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to