Github user culler commented on a diff in the pull request:
https://github.com/apache/spark/pull/3066#discussion_r19730958
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala ---
@@ -146,6 +146,31 @@ package object dsl {
def upper(e: Expression) = Upper(e)
def lower(e: Expression) = Lower(e)
+ /*
+ * Conversions to provide the standard operators in the special case
+ * where a literal is being combined with a symbol. Without these an
+ * expression such as 0 < 'x is not recognized.
+ */
+ implicit class InitialLiteral(x: Any) {
+ val literal = Literal(x)
+ def + (other: Symbol):Expression = {literal + other}
+ def - (other: Symbol):Expression = {literal - other}
+ def * (other: Symbol):Expression = {literal * other}
+ def / (other: Symbol):Expression = {literal / other}
+ def % (other: Symbol):Expression = {literal % other}
+
+ def && (other: Symbol):Expression = {literal && other}
+ def || (other: Symbol):Expression = {literal || other}
+
+ def < (other: Symbol):Expression = {literal < other}
+ def <= (other: Symbol):Expression = {literal <= other}
+ def > (other: Symbol):Expression = {literal > other}
+ def >= (other: Symbol):Expression = {literal >= other}
+ def === (other: Symbol):Expression = {literal === other}
+ def <=> (other: Symbol):Expression = {literal <=> other}
+ def !== (other: Symbol):Expression = {literal !== other}
--- End diff --
Thanks.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]