Skip to content

Commit a7b2928

Browse files
Fix
1 parent 48ea6e0 commit a7b2928

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

x-pack/plugin/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ tasks.named("yamlRestCompatTestTransform").configure({ task ->
134134
task.skipTest("esql/90_non_indexed/fetch", "Temporary until backported")
135135
task.skipTest("esql/63_enrich_int_range/Invalid age as double", "TODO: require disable allow_partial_results")
136136
task.skipTest("esql/191_lookup_join_on_datastreams/data streams not supported in LOOKUP JOIN", "Added support for aliases in JOINs")
137+
task.skipTest("esql/10_basic/Test wrong LIMIT parameter", "Different error message")
137138
})
138139

139140
tasks.named('yamlRestCompatTest').configure {

x-pack/plugin/esql-core/src/test/java/org/elasticsearch/xpack/esql/core/util/TestUtils.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
package org.elasticsearch.xpack.esql.core.util;
99

10+
import org.elasticsearch.common.lucene.BytesRefs;
1011
import org.elasticsearch.xpack.esql.core.expression.FieldAttribute;
1112
import org.elasticsearch.xpack.esql.core.expression.Literal;
1213
import org.elasticsearch.xpack.esql.core.tree.Source;
@@ -22,6 +23,8 @@
2223
import static org.elasticsearch.test.ESTestCase.randomFrom;
2324
import static org.elasticsearch.xpack.esql.core.tree.Source.EMPTY;
2425
import static org.elasticsearch.xpack.esql.core.type.DataType.INTEGER;
26+
import static org.elasticsearch.xpack.esql.core.type.DataType.KEYWORD;
27+
import static org.elasticsearch.xpack.esql.core.type.DataType.TEXT;
2528

2629
public final class TestUtils {
2730
private TestUtils() {}
@@ -39,6 +42,10 @@ public static Literal of(Source source, Object value) {
3942
if (value instanceof Literal) {
4043
return (Literal) value;
4144
}
45+
DataType type = DataType.fromJava(value);
46+
if (value instanceof String && (type == TEXT || type == KEYWORD)) {
47+
value = BytesRefs.toBytesRef(value);
48+
}
4249
return new Literal(source, value, DataType.fromJava(value));
4350
}
4451

@@ -58,12 +65,16 @@ public static FieldAttribute getFieldAttribute(String name, DataType dataType) {
5865
return new FieldAttribute(EMPTY, name, new EsField(name + "f", dataType, emptyMap(), true));
5966
}
6067

61-
/** Similar to {@link String#strip()}, but removes the WS throughout the entire string. */
68+
/**
69+
* Similar to {@link String#strip()}, but removes the WS throughout the entire string.
70+
*/
6271
public static String stripThrough(String input) {
6372
return WS_PATTERN.matcher(input).replaceAll(StringUtils.EMPTY);
6473
}
6574

66-
/** Returns the input string, but with parts of it having the letter casing changed. */
75+
/**
76+
* Returns the input string, but with parts of it having the letter casing changed.
77+
*/
6778
public static String randomCasing(String input) {
6879
StringBuilder sb = new StringBuilder(input.length());
6980
for (int i = 0, inputLen = input.length(), step = (int) Math.sqrt(inputLen); i < inputLen; i += step) {

0 commit comments

Comments
 (0)