Skip to content

Commit bf88bb7

Browse files
separate snapshot test from release test
1 parent 784ca1f commit bf88bb7

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,12 +2466,29 @@ by fn2(f3, {"option1":["string1","string2"],"option2":[1,2,3],"option3":2.0,"opt
24662466
assertEquals(List.of(referenceAttribute("bar", KEYWORD)), dissect.extractedFields());
24672467
UnresolvedRelation ur = as(dissect.child(), UnresolvedRelation.class);
24682468
assertEquals(ur, relation("test"));
2469+
}
24692470

2471+
public void testNamedFunctionArgumentInMapWithNamedParameters() {
24702472
// map entry values provided in named parameter, arrays are not supported by named parameters yet
24712473
assumeTrue(
24722474
"named parameters for identifiers and patterns require snapshot build",
24732475
EsqlCapabilities.Cap.NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES_SIMPLIFIED_SYNTAX.isEnabled()
24742476
);
2477+
LinkedHashMap<String, Object> expectedMap1 = new LinkedHashMap<>(4);
2478+
expectedMap1.put("option1", "string");
2479+
expectedMap1.put("option2", 1);
2480+
expectedMap1.put("option3", List.of(2.0, 3.0, 4.0));
2481+
expectedMap1.put("option4", List.of(true, false));
2482+
LinkedHashMap<String, Object> expectedMap2 = new LinkedHashMap<>(4);
2483+
expectedMap2.put("option1", List.of("string1", "string2"));
2484+
expectedMap2.put("option2", List.of(1, 2, 3));
2485+
expectedMap2.put("option3", 2.0);
2486+
expectedMap2.put("option4", true);
2487+
LinkedHashMap<String, Object> expectedMap3 = new LinkedHashMap<>(4);
2488+
expectedMap3.put("option1", "string");
2489+
expectedMap3.put("option2", 2.0);
2490+
expectedMap3.put("option3", List.of(1, 2, 3));
2491+
expectedMap3.put("option4", List.of(true, false));
24752492
assertEquals(
24762493
new Filter(
24772494
EMPTY,
@@ -2569,7 +2586,7 @@ by fn2(f3, {"option1":["string1","string2"],"option2":[1,2,3],"option3":2.0,"opt
25692586
)
25702587
);
25712588

2572-
plan = statement(
2589+
LogicalPlan plan = statement(
25732590
"""
25742591
from test
25752592
| dissect ?fn1(?n1, ?n2, {"option1":?n3,"option2":?n4,"option3":[2.0,3.0,4.0],"option4":[true,false]}) "%{bar}"
@@ -2589,16 +2606,16 @@ by fn2(f3, {"option1":["string1","string2"],"option2":[1,2,3],"option3":2.0,"opt
25892606
)
25902607
)
25912608
);
2592-
grok = as(plan, Grok.class);
2609+
Grok grok = as(plan, Grok.class);
25932610
assertEquals(function("fn2", List.of(attribute("f3"), mapExpression(expectedMap2))), grok.input());
25942611
assertEquals("%{WORD:foo}", grok.parser().pattern());
25952612
assertEquals(List.of(referenceAttribute("foo", KEYWORD)), grok.extractedFields());
2596-
dissect = as(grok.child(), Dissect.class);
2613+
Dissect dissect = as(grok.child(), Dissect.class);
25972614
assertEquals(function("fn1", List.of(attribute("f1"), attribute("f2"), mapExpression(expectedMap1))), dissect.input());
25982615
assertEquals("%{bar}", dissect.parser().pattern());
25992616
assertEquals("", dissect.parser().appendSeparator());
26002617
assertEquals(List.of(referenceAttribute("bar", KEYWORD)), dissect.extractedFields());
2601-
ur = as(dissect.child(), UnresolvedRelation.class);
2618+
UnresolvedRelation ur = as(dissect.child(), UnresolvedRelation.class);
26022619
assertEquals(ur, relation("test"));
26032620
}
26042621

0 commit comments

Comments
 (0)