quwin commented on PR #25025: URL: https://github.com/apache/datafusion/pull/25025#issuecomment-5638049536
Good question. from my understanding, non-literal dimensions as a column are already explicitly supported by `array_length`, and this affects any query reusing `array_length` in that shape more than once. I tested on this branch with the default optimizer: `SELECT x, x AS x2 FROM (SELECT array_length(column1, column2) AS x FROM t)` merges into a single `ProjectionExec` containing `array_length(column1@0, column2@1)` twice. The dimension-dependent per-row traversal is evaluated twice per row (and would keep being evaluated another time for every `x` reuse). With the get_field-style guard, the same query keeps the nested compute-once plan, while `array_length(column1, literal)` still merges as intended. Happy to help with a patch if useful. -- 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]
