@@ -2466,8 +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
2473+ assumeTrue (
2474+ "named parameters for identifiers and patterns require snapshot build" ,
2475+ EsqlCapabilities .Cap .NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES_SIMPLIFIED_SYNTAX .isEnabled ()
2476+ );
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 ));
24712492 assertEquals (
24722493 new Filter (
24732494 EMPTY ,
@@ -2565,7 +2586,7 @@ by fn2(f3, {"option1":["string1","string2"],"option2":[1,2,3],"option3":2.0,"opt
25652586 )
25662587 );
25672588
2568- plan = statement (
2589+ LogicalPlan plan = statement (
25692590 """
25702591 from test
25712592 | dissect ?fn1(?n1, ?n2, {"option1":?n3,"option2":?n4,"option3":[2.0,3.0,4.0],"option4":[true,false]}) "%{bar}"
@@ -2585,16 +2606,16 @@ by fn2(f3, {"option1":["string1","string2"],"option2":[1,2,3],"option3":2.0,"opt
25852606 )
25862607 )
25872608 );
2588- grok = as (plan , Grok .class );
2609+ Grok grok = as (plan , Grok .class );
25892610 assertEquals (function ("fn2" , List .of (attribute ("f3" ), mapExpression (expectedMap2 ))), grok .input ());
25902611 assertEquals ("%{WORD:foo}" , grok .parser ().pattern ());
25912612 assertEquals (List .of (referenceAttribute ("foo" , KEYWORD )), grok .extractedFields ());
2592- dissect = as (grok .child (), Dissect .class );
2613+ Dissect dissect = as (grok .child (), Dissect .class );
25932614 assertEquals (function ("fn1" , List .of (attribute ("f1" ), attribute ("f2" ), mapExpression (expectedMap1 ))), dissect .input ());
25942615 assertEquals ("%{bar}" , dissect .parser ().pattern ());
25952616 assertEquals ("" , dissect .parser ().appendSeparator ());
25962617 assertEquals (List .of (referenceAttribute ("bar" , KEYWORD )), dissect .extractedFields ());
2597- ur = as (dissect .child (), UnresolvedRelation .class );
2618+ UnresolvedRelation ur = as (dissect .child (), UnresolvedRelation .class );
25982619 assertEquals (ur , relation ("test" ));
25992620 }
26002621
@@ -2860,6 +2881,10 @@ public void testNamedFunctionArgumentInInvalidPositions() {
28602881 }
28612882
28622883 public void testNamedFunctionArgumentWithUnsupportedNamedParameterTypes () {
2884+ assumeTrue (
2885+ "named parameters for identifiers and patterns require snapshot build" ,
2886+ EsqlCapabilities .Cap .NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES_SIMPLIFIED_SYNTAX .isEnabled ()
2887+ );
28632888 Map <String , String > commands = Map .ofEntries (
28642889 Map .entry ("eval x = {}" , "29" ),
28652890 Map .entry ("where {}" , "26" ),
0 commit comments