Commit 37f3dd7a authored by Daniel Leaver's avatar Daniel Leaver Committed by GitHub
Browse files

Revert "Fix CASE when comparing null values ()" ()

This reverts commit b44bb4e01e4b1ebb71f6da1695c864dd84d3562e.
No related merge requests found
Showing with 1 addition and 71 deletions
+1 -71
......@@ -31,7 +31,7 @@ case class SimpleCase(expression: Expression, alternatives: Seq[(Expression, Exp
val value = expression(row, state)
val matchingExpression: Option[Expression] = alternatives collectFirst {
case (exp, res) if exp(row, state).equalsWithNoValueCheck(value) => res
case (exp, res) if exp(row, state) == value => res
}
matchingExpression match {
......
......@@ -330,61 +330,3 @@ Feature: CaseExpression
| count |
| 1 |
And no side effects
Scenario: When given null, any WHEN containing null should not match as null == null = null
When executing query:
"""
RETURN
CASE null
WHEN null THEN true
ELSE false
END AS res
"""
Then the result should be, in any order:
| res |
| false |
And no side effects
Scenario: When given null = null as a comparison it should evaluate to false
When executing query:
"""
RETURN
CASE
WHEN null = null THEN true
ELSE false
END AS res
"""
Then the result should be, in any order:
| res |
| false |
And no side effects
Scenario: When given null IS null as a comparison it should evaluate to true
When executing query:
"""
RETURN
CASE
WHEN null IS NULL THEN true
ELSE false
END AS res
"""
Then the result should be, in any order:
| res |
| true |
And no side effects
Scenario: When given null and no default, null should be returned
When executing query:
"""
RETURN
CASE null
WHEN null THEN true
END AS res
"""
Then the result should be, in any order:
| res |
| null |
And no side effects
......@@ -23,7 +23,6 @@ import org.neo4j.memory.Measurable;
import org.neo4j.values.storable.FloatingPointValue;
import org.neo4j.values.storable.NumberValue;
import org.neo4j.values.storable.ValueRepresentation;
import org.neo4j.values.storable.Values;
public abstract class AnyValue implements Measurable
{
......@@ -35,17 +34,6 @@ public abstract class AnyValue implements Measurable
return this == other || other != null && equalTo( other );
}
// In Cypher RETURN null = null; returns null. Therefore, in a binary equals we
// sometimes need to return false when matching e.g CASE null WHEN null THEN... shouldn't match on null
public boolean equalsWithNoValueCheck( Object other )
{
if ( this == Values.NO_VALUE && other == Values.NO_VALUE )
{
return false;
}
return this == other || other != null && equalTo(other);
}
@Override
public final int hashCode()
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment