wangyum commented on issue #4947:
URL: 
https://github.com/apache/incubator-gluten/issues/4947#issuecomment-2761767415

   @kecookier There is still a data issue if cast to float type first and then 
to decimal.
   
   How to reproduce this issue:
   ```sql
   CREATE TEMP TABLE t1 AS SELECT CAST('27867.64' AS decimal(38,2)) AS price;
   set spark.gluten.enabled=false;
   SELECT CAST(CAST(price AS FLOAT) AS DECIMAL(18,2)) FROM t1;
   
   set spark.gluten.enabled=true;
   SELECT CAST(CAST(price AS FLOAT) AS DECIMAL(18,2)) FROM t1;
   ```
   Output:
   ```
   0: jdbc:hive2://localhost:10000/> set spark.gluten.enabled=false;
   +-----------------------+--------+
   |          key          | value  |
   +-----------------------+--------+
   | spark.gluten.enabled  | false  |
   +-----------------------+--------+
   1 row selected (0.02 seconds)
   0: jdbc:hive2://localhost:10000/> SELECT CAST(CAST(price AS FLOAT) AS 
DECIMAL(18,2)) FROM t1;
   +----------------------------------------------+
   | CAST(CAST(price AS FLOAT) AS DECIMAL(18,2))  |
   +----------------------------------------------+
   | 27867.64                                     |
   +----------------------------------------------+
   1 row selected (0.138 seconds)
   0: jdbc:hive2://localhost:10000/> 
   0: jdbc:hive2://localhost:10000/> set spark.gluten.enabled=true;
   +-----------------------+--------+
   |          key          | value  |
   +-----------------------+--------+
   | spark.gluten.enabled  | true   |
   +-----------------------+--------+
   1 row selected (0.018 seconds)
   0: jdbc:hive2://localhost:10000/> SELECT CAST(CAST(price AS FLOAT) AS 
DECIMAL(18,2)) FROM t1;
   +----------------------------------------------+
   | CAST(CAST(price AS FLOAT) AS DECIMAL(18,2))  |
   +----------------------------------------------+
   | 27867.60                                     |
   +----------------------------------------------+
   1 row selected (0.301 seconds)
   ```


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