tinfoil-knight commented on issue #11594:
URL: https://github.com/apache/datafusion/issues/11594#issuecomment-2258914588

   DuckDB v1.0.0 (https://shell.duckdb.org/) behaves the same as Apache 
Datafusion. Doesn't consider associativity in expressions with a column 
reference.
   
   ```
   duckdb> EXPLAIN SELECT col0 + (1+2) FROM (VALUES (100));
   ┌───────────────────────────┐
   │         PROJECTION        │
   │   ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─   │
   │         (col0 + 3)        │
   └─────────────┬─────────────┘                             
   ┌─────────────┴─────────────┐
   │      COLUMN_DATA_SCAN     │
   └───────────────────────────┘
   
   duckdb> EXPLAIN SELECT col0 + 1+2 FROM (VALUES (100));
   ┌───────────────────────────┐
   │         PROJECTION        │
   │   ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─   │
   │      ((col0 + 1) + 2)     │
   └─────────────┬─────────────┘                             
   ┌─────────────┴─────────────┐
   │      COLUMN_DATA_SCAN     │
   └───────────────────────────┘ 
   
   duckdb> EXPLAIN SELECT (col0 + 1)+2 FROM (VALUES (100));
   ┌───────────────────────────┐
   │         PROJECTION        │
   │   ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─   │
   │      ((col0 + 1) + 2)     │
   └─────────────┬─────────────┘                             
   ┌─────────────┴─────────────┐
   │      COLUMN_DATA_SCAN     │
   └───────────────────────────┘
   
   duckdb> EXPLAIN SELECT (col0 + (1+3)*7+9)+(2*5+3-4+6) FROM (VALUES (100));
   ┌───────────────────────────┐
   │         PROJECTION        │
   │   ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─   │
   │  (((col0 + 28) + 9) + 15) │
   └─────────────┬─────────────┘                             
   ┌─────────────┴─────────────┐
   │      COLUMN_DATA_SCAN     │
   └───────────────────────────┘
   ```


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to