Josh Rosen created SPARK-28007: ---------------------------------- Summary: Caret operator (^) means bitwise XOR in Spark and exponentiation in Postgres/Redshift Key: SPARK-28007 URL: https://issues.apache.org/jira/browse/SPARK-28007 Project: Spark Issue Type: Sub-task Components: SQL Affects Versions: 3.0.0 Reporter: Josh Rosen
The expression {{expr1 ^ expr2}} has different meanings in Spark and Postgres: * [In Postgres|https://www.postgresql.org/docs/11/functions-math.html] and [Redshift|https://docs.aws.amazon.com/redshift/latest/dg/r_OPERATOR_SYMBOLS.html] , this returns {{expr1}} raised to the exponent {{expr2}} (additionally, the Postgres docs explicitly state that this operation is left-associative). * [In Spark|https://spark.apache.org/docs/2.4.3/api/sql/index.html#_14] and [Hive|https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-ArithmeticOperators], this returns the bitwise exclusive OR of {{expr1}} and {{expr2}}. I'm reporting this under the Postgres compatibility umbrella. If we have SQL dialect support (e.g. a Postgres compatibility dialect), maybe this behavior could be flagged there? -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org