liukun4515 commented on issue #3387: URL: https://github.com/apache/arrow-datafusion/issues/3387#issuecomment-1239356097
current plan for datafusion ``` ❯ explain select cast(1 as decimal(10,1)) + cast(2 as decimal(10,1)); +---------------+--------------------------------------------------------------+ | plan_type | plan | +---------------+--------------------------------------------------------------+ | logical_plan | Projection: Decimal128(Some(30),10,1) AS Int64(1) + Int64(2) | | | EmptyRelation | | physical_plan | ProjectionExec: expr=[Some(30),10,1 as Int64(1) + Int64(2)] | | | EmptyExec: produce_one_row=true | | | | +---------------+--------------------------------------------------------------+ ``` spark plan: ``` spark-sql> explain extended select cast(1 as decimal(10,1)) + cast(2 as decimal(10,1)); == Parsed Logical Plan == 'Project [unresolvedalias((cast(1 as decimal(10,1)) + cast(2 as decimal(10,1))), None)] +- OneRowRelation == Analyzed Logical Plan == (CAST(1 AS DECIMAL(10,1)) + CAST(2 AS DECIMAL(10,1))): decimal(11,1) Project [CheckOverflow((promote_precision(cast(cast(1 as decimal(10,1)) as decimal(11,1))) + promote_precision(cast(cast(2 as decimal(10,1)) as decimal(11,1)))), DecimalType(11,1), true) AS (CAST(1 AS DECIMAL(10,1)) + CAST(2 AS DECIMAL(10,1)))#166] +- OneRowRelation == Optimized Logical Plan == Project [3.0 AS (CAST(1 AS DECIMAL(10,1)) + CAST(2 AS DECIMAL(10,1)))#166] +- OneRowRelation == Physical Plan == *(1) Project [3.0 AS (CAST(1 AS DECIMAL(10,1)) + CAST(2 AS DECIMAL(10,1)))#166] +- *(1) Scan OneRowRelation[] Time taken: 0.017 seconds, Fetched 1 row(s) ``` -- 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]
