You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/01 07:37:14 UTC

[GitHub] [spark] gengliangwang edited a comment on issue #24849: [SPARK-28018][SQL] Allow upcasting decimal to double/float

gengliangwang edited a comment on issue #24849: [SPARK-28018][SQL] Allow upcasting decimal to double/float
URL: https://github.com/apache/spark/pull/24849#issuecomment-507143300
 
 
   @rdblue I have checked the [Information technology — Database languages — SQL —Part 2 Foundation (SQL/Foundation)](https://www.iso.org/standard/53682.html) of the year 2011
   
   In section 15.10: Effect of inserting tables into base tables
   ![image](https://user-images.githubusercontent.com/1097932/60416770-33dcdb80-9c11-11e9-9cc8-07b739fc2ef9.png)
   
   So we can refer the rules In section 9.2: Store assignment
   ![image](https://user-images.githubusercontent.com/1097932/60416836-5d960280-9c11-11e9-81be-29bb26897eba.png)
   
   From ISO SQL standard,  "If a value of the declared type of T can be obtained from V by rounding or truncation, then the value of T is set to that value". 
   Checking whether data types strictly upcast-able in analyzer doesn't match the standard. I think we can consider a new approach: 
   1. Always use `Cast` in table insertion if the input data type doesn't match the data type of table column
   2. `Cast` throws runtime exception on failure, instead of `Null` results.
   
   The new approach would be configurable. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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