SQL: add folding to BinaryComparison (elastic/x-pack-elasticsearch#3529)
* SQL: add folding to BinaryComparison Add missing folding to predicates and logical operators relates elastic/x-pack-elasticsearch#3528 Original commit: elastic/x-pack-elasticsearch@4a7d3765e5
This commit is contained in:
parent
9401569195
commit
ab14aa7059
|
@ -5,10 +5,10 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.sql.expression;
|
package org.elasticsearch.xpack.sql.expression;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import org.elasticsearch.xpack.sql.tree.Location;
|
import org.elasticsearch.xpack.sql.tree.Location;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Order extends UnaryExpression {
|
public class Order extends UnaryExpression {
|
||||||
|
|
||||||
public enum OrderDirection {
|
public enum OrderDirection {
|
||||||
|
@ -26,6 +26,11 @@ public class Order extends UnaryExpression {
|
||||||
return direction;
|
return direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean foldable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(child(), direction);
|
return Objects.hash(child(), direction);
|
||||||
|
|
|
@ -25,6 +25,11 @@ public abstract class UnaryExpression extends Expression {
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean foldable() {
|
||||||
|
return child.foldable();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean nullable() {
|
public boolean nullable() {
|
||||||
return child.nullable();
|
return child.nullable();
|
||||||
|
|
|
@ -10,12 +10,19 @@ import org.elasticsearch.xpack.sql.expression.BinaryOperator.Negateable;
|
||||||
import org.elasticsearch.xpack.sql.expression.Expression;
|
import org.elasticsearch.xpack.sql.expression.Expression;
|
||||||
import org.elasticsearch.xpack.sql.tree.Location;
|
import org.elasticsearch.xpack.sql.tree.Location;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class And extends BinaryLogic implements Negateable {
|
public class And extends BinaryLogic implements Negateable {
|
||||||
|
|
||||||
public And(Location location, Expression left, Expression right) {
|
public And(Location location, Expression left, Expression right) {
|
||||||
super(location, left, right);
|
super(location, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
return Objects.equals(left().fold(), Boolean.TRUE) && Objects.equals(right().fold(), Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Or negate() {
|
public Or negate() {
|
||||||
return new Or(location(), new Not(location(), left()), new Not(location(), right()));
|
return new Or(location(), new Not(location(), left()), new Not(location(), right()));
|
||||||
|
|
|
@ -32,4 +32,12 @@ public abstract class BinaryComparison extends BinaryOperator {
|
||||||
public DataType dataType() {
|
public DataType dataType() {
|
||||||
return DataTypes.BOOLEAN;
|
return DataTypes.BOOLEAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
static Integer compare(Object left, Object right) {
|
||||||
|
if (left instanceof Comparable && right instanceof Comparable) {
|
||||||
|
return Integer.valueOf(((Comparable) left).compareTo(right));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,19 @@ package org.elasticsearch.xpack.sql.expression.predicate;
|
||||||
import org.elasticsearch.xpack.sql.expression.Expression;
|
import org.elasticsearch.xpack.sql.expression.Expression;
|
||||||
import org.elasticsearch.xpack.sql.tree.Location;
|
import org.elasticsearch.xpack.sql.tree.Location;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Equals extends BinaryComparison {
|
public class Equals extends BinaryComparison {
|
||||||
|
|
||||||
public Equals(Location location, Expression left, Expression right) {
|
public Equals(Location location, Expression left, Expression right) {
|
||||||
super(location, left, right);
|
super(location, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
return Objects.equals(left().fold(), right().fold());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Equals swapLeftAndRight() {
|
public Equals swapLeftAndRight() {
|
||||||
return new Equals(location(), right(), left());
|
return new Equals(location(), right(), left());
|
||||||
|
|
|
@ -15,6 +15,12 @@ public class GreaterThan extends BinaryComparison implements Negateable {
|
||||||
super(location, left, right);
|
super(location, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
Integer compare = compare(left().fold(), right().fold());
|
||||||
|
return compare != null && compare.intValue() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LessThan swapLeftAndRight() {
|
public LessThan swapLeftAndRight() {
|
||||||
return new LessThan(location(), right(), left());
|
return new LessThan(location(), right(), left());
|
||||||
|
|
|
@ -15,6 +15,12 @@ public class GreaterThanOrEqual extends BinaryComparison implements Negateable {
|
||||||
super(location, left, right);
|
super(location, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
Integer compare = compare(left().fold(), right().fold());
|
||||||
|
return compare != null && compare.intValue() >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LessThanOrEqual swapLeftAndRight() {
|
public LessThanOrEqual swapLeftAndRight() {
|
||||||
return new LessThanOrEqual(location(), right(), left());
|
return new LessThanOrEqual(location(), right(), left());
|
||||||
|
|
|
@ -17,6 +17,11 @@ public class IsNotNull extends UnaryExpression {
|
||||||
super(location, child);
|
super(location, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
return child().fold() != null && !DataTypes.NULL.same(child().dataType());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean nullable() {
|
public boolean nullable() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -15,6 +15,12 @@ public class LessThan extends BinaryComparison implements Negateable {
|
||||||
super(location, left, right);
|
super(location, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
Integer compare = compare(left().fold(), right().fold());
|
||||||
|
return compare != null && compare.intValue() < 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GreaterThan swapLeftAndRight() {
|
public GreaterThan swapLeftAndRight() {
|
||||||
return new GreaterThan(location(), right(), left());
|
return new GreaterThan(location(), right(), left());
|
||||||
|
|
|
@ -15,6 +15,12 @@ public class LessThanOrEqual extends BinaryComparison implements Negateable {
|
||||||
super(location, left, right);
|
super(location, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
Integer compare = compare(left().fold(), right().fold());
|
||||||
|
return compare != null && compare.intValue() <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GreaterThanOrEqual swapLeftAndRight() {
|
public GreaterThanOrEqual swapLeftAndRight() {
|
||||||
return new GreaterThanOrEqual(location(), right(), left());
|
return new GreaterThanOrEqual(location(), right(), left());
|
||||||
|
|
|
@ -7,17 +7,34 @@ package org.elasticsearch.xpack.sql.expression.predicate;
|
||||||
|
|
||||||
import org.elasticsearch.xpack.sql.expression.BinaryOperator.Negateable;
|
import org.elasticsearch.xpack.sql.expression.BinaryOperator.Negateable;
|
||||||
import org.elasticsearch.xpack.sql.expression.Expression;
|
import org.elasticsearch.xpack.sql.expression.Expression;
|
||||||
|
import org.elasticsearch.xpack.sql.expression.Expressions;
|
||||||
import org.elasticsearch.xpack.sql.expression.UnaryExpression;
|
import org.elasticsearch.xpack.sql.expression.UnaryExpression;
|
||||||
import org.elasticsearch.xpack.sql.tree.Location;
|
import org.elasticsearch.xpack.sql.tree.Location;
|
||||||
import org.elasticsearch.xpack.sql.type.DataType;
|
import org.elasticsearch.xpack.sql.type.DataType;
|
||||||
import org.elasticsearch.xpack.sql.type.DataTypes;
|
import org.elasticsearch.xpack.sql.type.DataTypes;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Not extends UnaryExpression {
|
public class Not extends UnaryExpression {
|
||||||
|
|
||||||
public Not(Location location, Expression child) {
|
public Not(Location location, Expression child) {
|
||||||
super(location, child);
|
super(location, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TypeResolution resolveType() {
|
||||||
|
if (DataTypes.BOOLEAN.same(child().dataType())) {
|
||||||
|
return TypeResolution.TYPE_RESOLVED;
|
||||||
|
}
|
||||||
|
return new TypeResolution("Cannot negate expression ([" + Expressions.name(child()) + "] of type ["
|
||||||
|
+ child().dataType().esName() + "])");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
return Objects.equals(child().fold(), Boolean.TRUE) ? Boolean.FALSE : Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Expression canonicalize() {
|
protected Expression canonicalize() {
|
||||||
Expression canonicalChild = child().canonical();
|
Expression canonicalChild = child().canonical();
|
||||||
|
|
|
@ -10,12 +10,19 @@ import org.elasticsearch.xpack.sql.expression.BinaryOperator.Negateable;
|
||||||
import org.elasticsearch.xpack.sql.expression.Expression;
|
import org.elasticsearch.xpack.sql.expression.Expression;
|
||||||
import org.elasticsearch.xpack.sql.tree.Location;
|
import org.elasticsearch.xpack.sql.tree.Location;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Or extends BinaryLogic implements Negateable {
|
public class Or extends BinaryLogic implements Negateable {
|
||||||
|
|
||||||
public Or(Location location, Expression left, Expression right) {
|
public Or(Location location, Expression left, Expression right) {
|
||||||
super(location, left, right);
|
super(location, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
return Objects.equals(left().fold(), Boolean.TRUE) || Objects.equals(right().fold(), Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Or swapLeftAndRight() {
|
public Or swapLeftAndRight() {
|
||||||
return new Or(location(), right(), left());
|
return new Or(location(), right(), left());
|
||||||
|
|
|
@ -54,6 +54,16 @@ public class Range extends Expression {
|
||||||
return value.foldable() && lower.foldable() && upper.foldable();
|
return value.foldable() && lower.foldable() && upper.foldable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
Object val = value.fold();
|
||||||
|
Integer lowerCompare = BinaryComparison.compare(lower.fold(), val);
|
||||||
|
Integer upperCompare = BinaryComparison.compare(val, upper().fold());
|
||||||
|
boolean lowerComparsion = lowerCompare == null ? false : (includeLower ? lowerCompare <= 0 : lowerCompare < 0);
|
||||||
|
boolean upperComparsion = upperCompare == null ? false : (includeUpper ? upperCompare <= 0 : upperCompare < 0);
|
||||||
|
return lowerComparsion && upperComparsion;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean nullable() {
|
public boolean nullable() {
|
||||||
return value.nullable() && lower.nullable() && upper.nullable();
|
return value.nullable() && lower.nullable() && upper.nullable();
|
||||||
|
|
|
@ -11,6 +11,8 @@ import org.elasticsearch.xpack.sql.tree.Location;
|
||||||
import org.elasticsearch.xpack.sql.type.DataType;
|
import org.elasticsearch.xpack.sql.type.DataType;
|
||||||
import org.elasticsearch.xpack.sql.type.DataTypes;
|
import org.elasticsearch.xpack.sql.type.DataTypes;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Like extends BinaryExpression {
|
public class Like extends BinaryExpression {
|
||||||
|
|
||||||
public Like(Location location, Expression left, LikePattern right) {
|
public Like(Location location, Expression left, LikePattern right) {
|
||||||
|
@ -18,8 +20,9 @@ public class Like extends BinaryExpression {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LikePattern right() {
|
public Object fold() {
|
||||||
return (LikePattern) super.right();
|
Pattern p = Pattern.compile(right().fold().toString());
|
||||||
|
return p.matcher(left().fold().toString()).matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,6 +69,17 @@ public class LikePattern extends LeafExpression {
|
||||||
return indexNameWildcard;
|
return indexNameWildcard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean foldable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object fold() {
|
||||||
|
// being in Java, the Java regex is returned
|
||||||
|
return asJavaRegex();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean nullable() {
|
public boolean nullable() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -12,6 +12,8 @@ import org.elasticsearch.xpack.sql.tree.Location;
|
||||||
import org.elasticsearch.xpack.sql.type.DataType;
|
import org.elasticsearch.xpack.sql.type.DataType;
|
||||||
import org.elasticsearch.xpack.sql.type.DataTypes;
|
import org.elasticsearch.xpack.sql.type.DataTypes;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class RLike extends BinaryExpression {
|
public class RLike extends BinaryExpression {
|
||||||
|
|
||||||
public RLike(Location location, Expression left, Literal right) {
|
public RLike(Location location, Expression left, Literal right) {
|
||||||
|
@ -19,8 +21,9 @@ public class RLike extends BinaryExpression {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Literal right() {
|
public Object fold() {
|
||||||
return (Literal) super.right();
|
Pattern p = Pattern.compile(right().fold().toString());
|
||||||
|
return p.matcher(left().fold().toString()).matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -441,7 +441,7 @@ abstract class QueryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e instanceof Like) {
|
if (e instanceof Like) {
|
||||||
LikePattern p = ((Like) e).right();
|
LikePattern p = (LikePattern) ((Like) e).right();
|
||||||
if (inexact) {
|
if (inexact) {
|
||||||
q = new QueryStringQuery(e.location(), p.asLuceneWildcard(), target);
|
q = new QueryStringQuery(e.location(), p.asLuceneWildcard(), target);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.sql.JDBCType;
|
||||||
public class NullType extends AbstractDataType {
|
public class NullType extends AbstractDataType {
|
||||||
|
|
||||||
NullType() {
|
NullType() {
|
||||||
super(JDBCType.NULL, true);
|
super(JDBCType.NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,9 +20,15 @@ import org.elasticsearch.xpack.sql.expression.predicate.And;
|
||||||
import org.elasticsearch.xpack.sql.expression.predicate.Equals;
|
import org.elasticsearch.xpack.sql.expression.predicate.Equals;
|
||||||
import org.elasticsearch.xpack.sql.expression.predicate.GreaterThan;
|
import org.elasticsearch.xpack.sql.expression.predicate.GreaterThan;
|
||||||
import org.elasticsearch.xpack.sql.expression.predicate.GreaterThanOrEqual;
|
import org.elasticsearch.xpack.sql.expression.predicate.GreaterThanOrEqual;
|
||||||
|
import org.elasticsearch.xpack.sql.expression.predicate.IsNotNull;
|
||||||
import org.elasticsearch.xpack.sql.expression.predicate.LessThan;
|
import org.elasticsearch.xpack.sql.expression.predicate.LessThan;
|
||||||
import org.elasticsearch.xpack.sql.expression.predicate.LessThanOrEqual;
|
import org.elasticsearch.xpack.sql.expression.predicate.LessThanOrEqual;
|
||||||
|
import org.elasticsearch.xpack.sql.expression.predicate.Not;
|
||||||
import org.elasticsearch.xpack.sql.expression.predicate.Or;
|
import org.elasticsearch.xpack.sql.expression.predicate.Or;
|
||||||
|
import org.elasticsearch.xpack.sql.expression.predicate.Range;
|
||||||
|
import org.elasticsearch.xpack.sql.expression.regex.Like;
|
||||||
|
import org.elasticsearch.xpack.sql.expression.regex.LikePattern;
|
||||||
|
import org.elasticsearch.xpack.sql.expression.regex.RLike;
|
||||||
import org.elasticsearch.xpack.sql.optimizer.Optimizer.BinaryComparisonSimplification;
|
import org.elasticsearch.xpack.sql.optimizer.Optimizer.BinaryComparisonSimplification;
|
||||||
import org.elasticsearch.xpack.sql.optimizer.Optimizer.BooleanLiteralsOnTheRight;
|
import org.elasticsearch.xpack.sql.optimizer.Optimizer.BooleanLiteralsOnTheRight;
|
||||||
import org.elasticsearch.xpack.sql.optimizer.Optimizer.BooleanSimplification;
|
import org.elasticsearch.xpack.sql.optimizer.Optimizer.BooleanSimplification;
|
||||||
|
@ -205,6 +211,40 @@ public class OptimizerTests extends ESTestCase {
|
||||||
assertEquals(5, ((Literal) c).value());
|
assertEquals(5, ((Literal) c).value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testConstantFoldingBinaryComparison() {
|
||||||
|
assertEquals(Literal.FALSE, new ConstantFolding().rule(new GreaterThan(EMPTY, L(2), L(3))));
|
||||||
|
assertEquals(Literal.FALSE, new ConstantFolding().rule(new GreaterThanOrEqual(EMPTY, L(2), L(3))));
|
||||||
|
assertEquals(Literal.FALSE, new ConstantFolding().rule(new Equals(EMPTY, L(2), L(3))));
|
||||||
|
assertEquals(Literal.TRUE, new ConstantFolding().rule(new LessThanOrEqual(EMPTY, L(2), L(3))));
|
||||||
|
assertEquals(Literal.TRUE, new ConstantFolding().rule(new LessThan(EMPTY, L(2), L(3))));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testConstantFoldingBinaryLogic() {
|
||||||
|
assertEquals(Literal.FALSE, new ConstantFolding().rule(new And(EMPTY, new GreaterThan(EMPTY, L(2), L(3)), Literal.TRUE)));
|
||||||
|
assertEquals(Literal.TRUE, new ConstantFolding().rule(new Or(EMPTY, new GreaterThanOrEqual(EMPTY, L(2), L(3)), Literal.TRUE)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testConstantFoldingRange() {
|
||||||
|
assertEquals(Literal.TRUE, new ConstantFolding().rule(new Range(EMPTY, L(5), L(5), true, L(10), false)));
|
||||||
|
assertEquals(Literal.FALSE, new ConstantFolding().rule(new Range(EMPTY, L(5), L(5), false, L(10), false)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testConstantIsNotNull() {
|
||||||
|
assertEquals(Literal.FALSE, new ConstantFolding().rule(new IsNotNull(EMPTY, L(null))));
|
||||||
|
assertEquals(Literal.TRUE, new ConstantFolding().rule(new IsNotNull(EMPTY, L(5))));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testConstantNot() {
|
||||||
|
assertEquals(Literal.FALSE, new ConstantFolding().rule(new Not(EMPTY, Literal.TRUE)));
|
||||||
|
assertEquals(Literal.TRUE, new ConstantFolding().rule(new Not(EMPTY, Literal.FALSE)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testConstantFoldingLikes() {
|
||||||
|
assertEquals(Literal.TRUE,
|
||||||
|
new ConstantFolding().rule(new Like(EMPTY, Literal.of(EMPTY, "test_emp"), new LikePattern(EMPTY, "test%", (char) 0))));
|
||||||
|
assertEquals(Literal.TRUE,
|
||||||
|
new ConstantFolding().rule(new RLike(EMPTY, Literal.of(EMPTY, "test_emp"), Literal.of(EMPTY, "test.emp"))));
|
||||||
|
}
|
||||||
|
|
||||||
public void testBinaryComparisonSimplification() {
|
public void testBinaryComparisonSimplification() {
|
||||||
assertEquals(Literal.TRUE, new BinaryComparisonSimplification().rule(new Equals(EMPTY, L(5), L(5))));
|
assertEquals(Literal.TRUE, new BinaryComparisonSimplification().rule(new Equals(EMPTY, L(5), L(5))));
|
||||||
|
@ -224,7 +264,6 @@ public class OptimizerTests extends ESTestCase {
|
||||||
assertEquals(L(5), eq.right());
|
assertEquals(L(5), eq.right());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testBoolSimplifyOr() {
|
public void testBoolSimplifyOr() {
|
||||||
BooleanSimplification simplification = new BooleanSimplification();
|
BooleanSimplification simplification = new BooleanSimplification();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class LikeEscapingParsingTests extends ESTestCase {
|
||||||
Expression exp = parser.createExpression(String.format(Locale.ROOT, "exp LIKE %s", pattern));
|
Expression exp = parser.createExpression(String.format(Locale.ROOT, "exp LIKE %s", pattern));
|
||||||
assertThat(exp, instanceOf(Like.class));
|
assertThat(exp, instanceOf(Like.class));
|
||||||
Like l = (Like) exp;
|
Like l = (Like) exp;
|
||||||
return l.right();
|
return (LikePattern) l.right();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoEscaping() {
|
public void testNoEscaping() {
|
||||||
|
|
Loading…
Reference in New Issue