szehon-ho commented on code in PR #58385:
URL: https://github.com/apache/spark/pull/58385#discussion_r3884792576
##########
sql/api/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -13124,6 +13403,10 @@ object functions {
* @since 3.5.0
* @return
* Returns a column that evaluates to a timestamp.
+ *
+ * @note
+ * Affected by these public SQL configurations:
+ * - `spark.sql.session.timeZone`
Review Comment:
Both `ParseToTimestampLTZExpressionBuilder` and
`ParseToTimestampNTZExpressionBuilder` construct `ParseToTimestamp`, whose
`failOnError` defaults to `SQLConf.get.ansiEnabled`. Invalid input therefore
throws with ANSI enabled and returns null otherwise. Please add
`spark.sql.ansi.enabled` here and document it on both `to_timestamp_ntz`
overloads, including their Python counterpart.
##########
sql/api/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -16567,6 +17106,12 @@ object functions {
* @since 4.1.0
* @return
* Returns a column that evaluates to a timestamp.
+ *
+ * @note
+ * Affected by these public SQL configurations:
+ * - `spark.sql.ansi.enabled`
Review Comment:
These configurations are copied onto overloads that do not read them.
`make_timestamp(date, time, timezone)` dispatches to
`MakeTimestampFromDateTime`, whose result is fixed to `TimestampType` and which
has no ANSI flag; the explicit timezone also bypasses the session timezone.
Similar false positives occur for `make_timestamp_ntz(date, time)`,
explicit-timezone LTZ variants, and no-argument `unix_timestamp()`. Could we
derive these notes per overload rather than per function name?
##########
sql/api/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -1724,6 +1736,10 @@ object functions {
* @since 1.3.0
* @return
* Returns a column that evaluates to a numeric or interval.
+ *
+ * @note
+ * Affected by these public SQL configurations:
+ * - `spark.sql.ansi.enabled`
Review Comment:
The coverage still misses public functions backed directly by the same
configuration-sensitive expressions: `mean` uses `Average`,
`sum_distinct`/`sumDistinct` uses `Sum`, `negative`/`negate` uses `UnaryMinus`,
`pmod` uses an ANSI-sensitive `NumericEvalContext`, and `try_reflect` still
checks `spark.sql.reflect.allowList`. Could these Scala and Python functions be
included as well?
--
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]