Vladislav Pyatkov created IGNITE-28690:
------------------------------------------

             Summary: SQL node rewrite extension cannot safely transform 
expressions with dynamic parameters
                 Key: IGNITE-28690
                 URL: https://issues.apache.org/jira/browse/IGNITE-28690
             Project: Ignite
          Issue Type: Improvement
            Reporter: Vladislav Pyatkov


Some Ignite SQL extensions need to transform SQL expressions during the 
`SqlNode` rewrite phase (IGNITE-27940).
This works well for purely structural rewrites or expressions that contain only 
literals. However, it becomes problematic when the expression contains dynamic 
parameters.
For example, an extension may need to transform an expression like:
{code:sql}
some_special_expression <= NVL(?, 100000)
{code}
into a different SQL shape where the parameter has to be moved to another part 
of the query tree, or where the expression has to be replaced with a value 
computed from the parameter.
Currently this is not safe or not possible:
* Replacing a parameter-dependent expression with a concrete value would be 
incorrect because the prepared plan may be reused with different parameter 
values.
* Moving an existing dynamic parameter to another place in the query tree may 
fail validation/planning, depending on where the parameter is moved.
* The rewrite extension cannot introduce additional bind parameters together 
with their runtime values.



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

Reply via email to