xinrong-databricks commented on a change in pull request #35533:
URL: https://github.com/apache/spark/pull/35533#discussion_r808913715
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
##########
@@ -2562,18 +2562,17 @@ case class ToBinary(expr: Expression, format:
Option[Expression], child: Express
def this(expr: Expression, format: Expression) = this(expr, Option(format),
format match {
- case lit if lit.foldable =>
+ case lit if (lit.foldable && Seq(StringType,
NullType).contains(lit.dataType)) =>
Review comment:
Snowflake doesn't specify that in their document, but BigQuery and
Teradata support `to_binary('abc', null)`:
[Expressions, functions, and operators | BigQuery | Google
Cloud](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#format_string_as_bytes)
"If an operand is NULL, the result is NULL, with the exception of the IS
operator."
[Teradata Online Documentation | Quick access to technical
manuals](https://docs.teradata.com/r/kmuOwjp1zEYg98JsB8fu_A/etRo5aTAY9n5fUPjxSEynw)
"If either instring or in_encoding is NULL, the result is NULL."
--
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]