gruuya opened a new issue, #7315:
URL: https://github.com/apache/arrow-datafusion/issues/7315

   ### Describe the bug
   
   When building the plan for the `UPDATE` statements the fields from the 
predicate (i.e. the `WHERE` clause) expressions are left unqualified.
   
   This leads to an issue when running optimizations on the plan (in particular 
`PushDownProjection`), and so one can't just call `state.optimize(&plan)`.
   
   ### To Reproduce
   
   ```sql
   $ cargo run
       Finished dev [unoptimized + debuginfo] target(s) in 1.31s
        Running `target/debug/datafusion-cli`
   DataFusion CLI v29.0.0
   ❯ create table test(a int, b text) as select 1, 'one';
   0 rows in set. Query took 0.094 seconds.
   
   ❯ explain update test set a = 2, b = 'two' where a = 1 and b = 'one';
   +--------------+-----------------------------------------------+
   | plan_type    | plan                                          |
   +--------------+-----------------------------------------------+
   | logical_plan | Dml: op=[Update] table=[test]                 |
   |              |   Projection: Int64(2) AS a, Utf8("two") AS b |
   |              |     Filter: a = Int32(1) AND b = Utf8("one")  |
   |              |       TableScan: test projection=[a, b]       |
   +--------------+-----------------------------------------------+
   ```
   Note the lack of qualification for the filter node.
   
   ### Expected behavior
   
   Expected to see the filter fields be fully qualified as well, like for the 
select
   ```sql
   ❯ explain select a, b from test where a = 1 and b = 'one';
   +---------------+----------------------------------------------------+
   | plan_type     | plan                                               |
   +---------------+----------------------------------------------------+
   | logical_plan  | Filter: test.a = Int32(1) AND test.b = Utf8("one") |
   |               |   TableScan: test projection=[a, b]                |
   | physical_plan | CoalesceBatchesExec: target_batch_size=8192        |
   |               |   FilterExec: a@0 = 1 AND b@1 = one                |
   |               |     MemoryExec: partitions=1, partition_sizes=[1]  |
   |               |                                                    |
   +---------------+----------------------------------------------------+
   ```
   
   ### Additional context
   
   _No response_


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

Reply via email to