Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ class V2ExpressionBuilder(e: Expression, isPredicate: Boolean = false) {
val r = generateExpression(b.right)
if (l.isDefined && r.isDefined) {
b match {
case _: Predicate if isBinaryComparisonOperator(b.sqlOperator) &&
l.get.isInstanceOf[LiteralValue[_]] && r.get.isInstanceOf[FieldReference] =>
case _: BinaryComparison if l.get.isInstanceOf[LiteralValue[_]] &&
r.get.isInstanceOf[FieldReference] =>
Some(new V2Predicate(flipComparisonOperatorName(b.sqlOperator),
Array[V2Expression](r.get, l.get)))
case _: Predicate =>
Expand Down Expand Up @@ -269,13 +269,6 @@ class V2ExpressionBuilder(e: Expression, isPredicate: Boolean = false) {
case _ => None
}

private def isBinaryComparisonOperator(operatorName: String): Boolean = {
operatorName match {
case ">" | "<" | ">=" | "<=" | "=" | "<=>" => true
case _ => false
}
}

private def flipComparisonOperatorName(operatorName: String): String = {
operatorName match {
case ">" => "<"
Expand Down