Skip to content
Snippets Groups Projects
Commit 363bfe30 authored by Takeshi Yamamuro's avatar Takeshi Yamamuro Committed by gatorsmile
Browse files

[SPARK-20073][SQL] Prints an explicit warning message in case of NULL-safe equals

## What changes were proposed in this pull request?
This pr added code to print the same warning messages with `===` cases when using NULL-safe equals (`<=>`).

## How was this patch tested?
Existing tests.

Author: Takeshi Yamamuro <yamamuro@apache.org>

Closes #18436 from maropu/SPARK-20073.
parent 17bdc36e
No related branches found
No related tags found
No related merge requests found
......@@ -464,7 +464,15 @@ class Column(val expr: Expression) extends Logging {
* @group expr_ops
* @since 1.3.0
*/
def <=> (other: Any): Column = withExpr { EqualNullSafe(expr, lit(other).expr) }
def <=> (other: Any): Column = withExpr {
val right = lit(other).expr
if (this.expr == right) {
logWarning(
s"Constructing trivially true equals predicate, '${this.expr} <=> $right'. " +
"Perhaps you need to use aliases.")
}
EqualNullSafe(expr, right)
}
/**
* Equality test that is safe for null values.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment