gengliangwang commented on a change in pull request #34985: URL: https://github.com/apache/spark/pull/34985#discussion_r773914844
########## File path: docs/sql-ref-ansi-compliance.md ########## @@ -70,23 +70,20 @@ SELECT abs(-2147483648); When `spark.sql.ansi.enabled` is set to `true`, explicit casting by `CAST` syntax throws a runtime exception for illegal cast patterns defined in the standard, e.g. casts from a string to an integer. -The `CAST` clause of Spark ANSI mode follows the syntax rules of section 6.13 "cast specification" in [ISO/IEC 9075-2:2011 Information technology — Database languages - SQL — Part 2: Foundation (SQL/Foundation)](https://www.iso.org/standard/53682.html), except it specially allows the following - straightforward type conversions which are disallowed as per the ANSI standard: -* NumericType <=> BooleanType -* StringType <=> BinaryType -* ArrayType => String -* MapType => String -* StructType => String +Comparing to the default behavior, the ANSI SQL mode also disallows the following type conversions: +* Numeric <=> Binary +* Date <=> Boolean +* Timestamp <=> Boolean Review comment: I feel there is already a lot of information here. The casting exists on non-ANSI mode and users should be used to it already. If we have to mention the conf, we should explain a little bit about the details ``` timestamp <=> numeric: the number is consider as seconds since epoch date => numeric: allowed, always return null(in ANSI we don’t usually return null..) numeric => date: not allowed. ``` -- 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]
