|
21 | 21 | import org.elasticsearch.xpack.sql.expression.predicate.operator.arithmetic.Add;
|
22 | 22 | import org.elasticsearch.xpack.sql.expression.predicate.operator.arithmetic.Mul;
|
23 | 23 | import org.elasticsearch.xpack.sql.expression.predicate.operator.arithmetic.Sub;
|
| 24 | +import org.elasticsearch.xpack.sql.proto.SqlTypedParamValue; |
24 | 25 |
|
25 | 26 | import java.time.Duration;
|
26 | 27 | import java.time.Period;
|
27 | 28 | import java.time.temporal.TemporalAmount;
|
| 29 | +import java.util.Collections; |
28 | 30 | import java.util.Locale;
|
29 | 31 |
|
30 | 32 | import static java.lang.String.format;
|
31 | 33 | import static org.elasticsearch.xpack.ql.type.DataTypes.BOOLEAN;
|
32 | 34 | import static org.elasticsearch.xpack.ql.type.DataTypes.DOUBLE;
|
33 | 35 | import static org.elasticsearch.xpack.ql.type.DataTypes.INTEGER;
|
| 36 | +import static org.elasticsearch.xpack.ql.type.DataTypes.KEYWORD; |
34 | 37 | import static org.elasticsearch.xpack.ql.type.DataTypes.LONG;
|
35 | 38 | import static org.hamcrest.Matchers.startsWith;
|
36 | 39 |
|
@@ -542,4 +545,11 @@ public void testCaseWithOperand() {
|
542 | 545 | assertEquals("WHEN 1 THEN 'one'", ifc.sourceText());
|
543 | 546 | assertEquals("many", c.elseResult().toString());
|
544 | 547 | }
|
| 548 | + |
| 549 | + public void testLikePatternWithNullParameterNotAllowed() { |
| 550 | + ParsingException e = expectThrows(ParsingException.class, |
| 551 | + () -> parser.createExpression("a LIKE ?", |
| 552 | + Collections.singletonList(new SqlTypedParamValue(KEYWORD.typeName(), null)))); |
| 553 | + assertEquals("line 1:9: Pattern must not be [null]", e.getMessage()); |
| 554 | + } |
545 | 555 | }
|
0 commit comments