pepijnve commented on issue #25329:
URL: https://github.com/apache/datafusion/issues/25329#issuecomment-5698128596

   Here's an excerpt of the optimisation output from current `main` 
(606ae0f697380a5bb903909f7ee3c731abbc6b79).
   
   ```
   initial_logical_plan                  | Projection: t.a
                                         |   Filter: CASE WHEN arrow_field(t.a) 
IS NOT NULL THEN get_field(arrow_field(t.a), Utf8("nullable")) IS NULL END
                                         |     TableScan: t
   after simplify_expressions            | Projection: t.a
                                         |   Filter: arrow_field(t.a) IS NOT 
NULL AND get_field(arrow_field(t.a), Utf8("nullable")) IS NULL OR 
arrow_field(t.a) IS NULL AND Boolean(NULL)
                                         |     TableScan: t
   after common_sub_expression_eliminate | Projection: t.a
                                         |   Projection: t.a
                                         |     Filter: __common_expr_1 IS NOT 
NULL AND get_field(__common_expr_1, Utf8("nullable")) IS NULL OR 
__common_expr_1 IS NULL AND Boolean(NULL)
                                         |       Projection: arrow_field(t.a) 
AS __common_expr_1, t.a
                                         |         TableScan: t
   after extract_leaf_expressions        | Projection: t.a
                                         |   Projection: t.a
                                         |     Projection: __common_expr_1, t.a
                                         |       Filter: __common_expr_1 IS NOT 
NULL AND __datafusion_extracted_2 IS NULL OR __common_expr_1 IS NULL AND 
Boolean(NULL)
                                         |         Projection: arrow_field(t.a) 
AS __common_expr_1, t.a, get_field(arrow_field(t.a), Utf8("nullable")) AS 
__datafusion_extracted_2
                                         |           TableScan: t
   ```
   
   Here too it's `extract_leaf_expressions` that's causing the function call 
duplication.


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

Reply via email to