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/08/28 08:59:13 UTC

[GitHub] [spark] gengliangwang commented on a change in pull request #25605: [SPARK-28730][SPARK-28495][SQL][FOLLOW-UP] Revise the doc of option spark.sql.storeAssignmentPolicy

gengliangwang commented on a change in pull request #25605: [SPARK-28730][SPARK-28495][SQL][FOLLOW-UP] Revise the doc of option spark.sql.storeAssignmentPolicy
URL: https://github.com/apache/spark/pull/25605#discussion_r318464933
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
 ##########
 @@ -1643,12 +1643,16 @@ object SQLConf {
   val STORE_ASSIGNMENT_POLICY =
     buildConf("spark.sql.storeAssignmentPolicy")
       .doc("When inserting a value into a column with different data type, Spark will perform " +
-        "type coercion. Currently we support 3 policies for the type coercion rules: ansi, " +
-        "legacy and strict. With ansi policy, Spark performs the type coercion as per ANSI SQL. " +
-        "With legacy policy, Spark allows casting any value to any data type. " +
-        "The legacy policy is the only behavior in Spark 2.x and it is compatible with Hive. " +
+        "type coercion. Currently, we support 3 policies for the type coercion rules: ANSI, " +
+        "legacy and strict. With ANSI policy, Spark performs the type coercion as per ANSI SQL. " +
+        "In practice, it follows PostgreSQL. It disallows certain unreasonable type conversions " +
 
 Review comment:
   This is because the ANSI store assignment rules are high level specified.
   Take the `string` -> `int` as an example, it doesn't explicit specifying whether string columns can be converted to integer columns. I tried Mysql/Oracle and the conversion is allowed, while PostgreSQL disallows it. 
   As we are porting tests from PostgreSQL (SPARK-27763), Spark tends to follow PostgreSQL in behaviors. On the table insertion, I think the rules of PostgreSQL are stricter and more reasonable comparing to MySQL/Oracle. For more details see the docs summarized by @maropu  https://docs.google.com/spreadsheets/u/1/d/1I4pl1TIe8u0G4sGSc7OCItySfvK0pOTkU4IPw5Z0Qck/edit?usp=sharing .
   
   So I think we should point out that we are following PostgreSQL particularly. 
   

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