wangyum commented on a change in pull request #35220:
URL: https://github.com/apache/spark/pull/35220#discussion_r786429857



##########
File path: 
sql/core/src/test/resources/sql-tests/results/typeCoercion/native/concat.sql.out
##########
@@ -40,16 +40,16 @@ FROM (
 -- !query schema
 struct<col:string>
 -- !query output
-prefix_0120.0
-prefix_1231.0
-prefix_2342.0
-prefix_3453.0
-prefix_4564.0
-prefix_5675.0
-prefix_6786.0
-prefix_7897.0
-prefix_89108.0
-prefix_910119.0
+prefix_0120
+prefix_1231
+prefix_2342
+prefix_3453
+prefix_4564
+prefix_5675
+prefix_6786
+prefix_7897
+prefix_89108
+prefix_910119

Review comment:
       It seems it is not safe when casting `IntegralType` to `DoubleType`.
   ```
   spark.sql("create table t1(id long) using parquet")
   spark.sql("insert into t1 values(1)")
   spark.sql("insert into t1 values(92233720368547758L)")
   spark.sql("select id, cast(cast(id as double) as string) from 
t1").show(false)
   ```
   Before this pr:
   ```
   +-----------------+----------------------------------+
   |id               |CAST(CAST(id AS DOUBLE) AS STRING)|
   +-----------------+----------------------------------+
   |92233720368547758|9.223372036854776E16              |
   |1                |1.0                               |
   +-----------------+----------------------------------+
   ```
   
   After this pr:
   ```
   +-----------------+----------------------------------+
   |id               |CAST(CAST(id AS DOUBLE) AS STRING)|
   +-----------------+----------------------------------+
   |1                |1                                 |
   |92233720368547758|92233720368547758                 |
   +-----------------+----------------------------------+
   ```




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to