cloud-fan commented on a change in pull request #25453: [WIP][SPARK-28730][SQL] 
Configurable type coercion policy for table insertion
URL: https://github.com/apache/spark/pull/25453#discussion_r315280808
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
 ##########
 @@ -1642,6 +1642,24 @@ object SQLConf {
       .checkValues(PartitionOverwriteMode.values.map(_.toString))
       .createWithDefault(PartitionOverwriteMode.STATIC.toString)
 
+  object StoreAssignmentPolicy extends Enumeration {
+    val LEGACY, STRICT = Value
+  }
+
+  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 2 policies for the type coercion 
rules: legacy and " +
+        "strict. 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. " +
+        "With strict policy, Spark doesn't allow any possible precision loss 
or data truncation " +
+        "in type coercion, e.g. `int` and `long`, `float` -> `double` are not 
allowed."
 
 Review comment:
   e.g. `int` to `long`, `timestamp` to `date` ...

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to