alamb commented on issue #17801: URL: https://github.com/apache/datafusion/issues/17801#issuecomment-3508475080
I was thinking about this one some more: - https://github.com/apache/datafusion/pull/18536 The reason the issue was masked was a second simplification seems to have cleaned up the expresion I looked briefly into the simplifier and I am not quite sure why that is. Here is some printouys of When running ```shell test --test tpcds_planning tpcds_physical_q75 -- --exact ``` With the code in https://github.com/apache/datafusion/pull/18536/files https://github.com/apache/datafusion/blob/6852d502a8fac35a21efcb5a59b398208379fe0a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs#L241-L240 ``` AAL Starting simplification for expr: Alias(Alias { expr: BinaryExpr(BinaryExpr { left: Cast(Cast { expr: Column(Column { relation: Some(Bare { table: "catalog_sales" }), name: "cs_quantity" }), data_type: Int64 }), op: Minus, right: ScalarFunction(ScalarFunction { func: ScalarUDF { inner: CoalesceFunc { signature: Signature { type_signature: UserDefined, volatility: Immutable, parameter_names: None } } }, args: [Cast(Cast { expr: Column(Column { relation: Some(Bare { table: "catalog_returns" }), name: "cr_return_quantity" }), data_type: Int64 }), Literal(Int64(0), None)] }) }), relation: None, name: "sales_cnt", metadata: None }) AAL Simplifying cycle 0/3, has_transformed=false 'CAST(catalog_sales.cs_quantity AS Int64) - coalesce(CAST(catalog_returns.cr_return_quantity AS Int64), Int64(0)) AS sales_cnt', AAL Simplifying cycle 1/3, has_transformed=true 'CAST(catalog_sales.cs_quantity AS Int64) - CASE WHEN CAST(catalog_returns.cr_return_quantity AS Int64) IS NOT NULL THEN CAST(catalog_returns.cr_return_quantity AS Int64) ELSE Int64(0) END AS sales_cnt', ``` -- 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]
