gengliangwang commented on a change in pull request #33516:
URL: https://github.com/apache/spark/pull/33516#discussion_r676772010
##########
File path: docs/sql-ref-ansi-compliance.md
##########
@@ -160,6 +160,81 @@ SELECT * FROM t;
+---+
```
+### Type coercion
+#### Type Promotion and Precedence
+When `spark.sql.ansi.enabled` is set to `true`, Spark SQL uses several rules
that govern how conflicts between data types are resolved.
+At the heart of this conflict resolution is the Type Precedence List which
defines whether values of a given data type can be promoted to another data
type implicitly.
+
+| Data type | precedence list(from narrowest to widest)
|
+|-----------|------------------------------------------------------------------|
+| Byte | Byte -> Short -> Int -> Long -> Decimal -> Float* -> Double
|
+| Short | Short -> Int -> Long -> Decimal-> Float* -> Double
|
+| Int | Int -> Long -> Decimal -> Float* -> Double
|
+| Long | Long -> Decimal -> Float* -> Double
|
+| Decimal | Decimal -> Float* -> Double
|
+| Float | Float -> Double
|
+| Double | Double
|
+| Date | Date-> Timestamp
|
+| Timestamp | Timestamp
|
+| String | String
|
+| Binary | Binary
|
+| Boolean | Boolean
|
+| Interval | Interval
|
Review comment:
Let's keep it simple in this section
--
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]