Github user DonnyZone commented on a diff in the pull request:
https://github.com/apache/spark/pull/19559#discussion_r147068164
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -783,6 +783,25 @@ class Analyzer(
}
}
+ /**
+ * Literal functions do not require the user to specify braces when
calling them
+ * When an attributes is not resolvable, we try to resolve it as a
literal function.
+ */
+ private def resolveAsLiteralFunctions(nameParts: Seq[String]):
Option[NamedExpression] = {
+ if (nameParts.length != 1) {
+ return None
+ }
+ // support CURRENT_DATE and CURRENT_TIMESTAMP
+ val literalFunctions = Seq(CurrentDate(), CurrentTimestamp())
+ val name = nameParts.head
+ val func = literalFunctions.find(e => resolver(e.prettyName, name))
+ if (func.isDefined) {
--- End diff --
Thanks, I will refactor it.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]