@@ -803,6 +803,7 @@ public void testDoubleParamsForIdentifiers() throws IOException {
803803 );
804804 bulkLoadTestData (10 );
805805 // positive
806+ // named double parameters
806807 var query = requestObjectBuilder ().query (
807808 format (
808809 null ,
@@ -814,13 +815,9 @@ public void testDoubleParamsForIdentifiers() throws IOException {
814815 "[{\" n1\" : \" integer\" }, {\" n2\" : \" short\" }, {\" n3\" : \" double\" }, {\" n4\" : \" boolean\" }, "
815816 + "{\" n5\" : \" xx2\" }, {\" fn1\" : \" max\" }]"
816817 );
817- Map <String , Object > result = runEsql (query );
818- Map <String , String > colA = Map .of ("name" , "boolean" , "type" , "boolean" );
819- Map <String , String > colB = Map .of ("name" , "xx2" , "type" , "double" );
820- assertEquals (List .of (colA , colB ), result .get ("columns" ));
821- assertEquals (List .of (List .of (false , 9.1 ), List .of (true , 8.1 )), result .get ("values" ));
818+ validateResultsOfDoubleParametersForIdentifiers (query );
822819
823- // positional
820+ // positional double parameters
824821 query = requestObjectBuilder ().query (
825822 format (
826823 null ,
@@ -832,11 +829,7 @@ public void testDoubleParamsForIdentifiers() throws IOException {
832829 "[{\" n1\" : \" integer\" }, {\" n2\" : \" short\" }, {\" n3\" : \" double\" }, {\" n4\" : \" boolean\" }, "
833830 + "{\" n5\" : \" xx2\" }, {\" fn1\" : \" max\" }]"
834831 );
835- result = runEsql (query );
836- colA = Map .of ("name" , "boolean" , "type" , "boolean" );
837- colB = Map .of ("name" , "xx2" , "type" , "double" );
838- assertEquals (List .of (colA , colB ), result .get ("columns" ));
839- assertEquals (List .of (List .of (false , 9.1 ), List .of (true , 8.1 )), result .get ("values" ));
832+ validateResultsOfDoubleParametersForIdentifiers (query );
840833
841834 query = requestObjectBuilder ().query (
842835 format (
@@ -845,34 +838,22 @@ public void testDoubleParamsForIdentifiers() throws IOException {
845838 testIndexName ()
846839 )
847840 ).params ("[\" integer\" , \" short\" , \" double\" , \" boolean\" , \" xx2\" , \" max\" ]" );
848- result = runEsql (query );
849- colA = Map .of ("name" , "boolean" , "type" , "boolean" );
850- colB = Map .of ("name" , "xx2" , "type" , "double" );
851- assertEquals (List .of (colA , colB ), result .get ("columns" ));
852- assertEquals (List .of (List .of (false , 9.1 ), List .of (true , 8.1 )), result .get ("values" ));
841+ validateResultsOfDoubleParametersForIdentifiers (query );
853842
854- // anonymous
843+ // anonymous double parameters
855844 query = requestObjectBuilder ().query (
856845 format (null , "from {} | eval x1 = ?? | where ?? == x1 | stats xx2 = ??(??) by ?? | keep ??, ?? | sort ??" , testIndexName ())
857846 )
858847 .params (
859848 "[{\" n1\" : \" integer\" }, {\" n2\" : \" short\" }, {\" fn1\" : \" max\" }, {\" n3\" : \" double\" }, {\" n4\" : \" boolean\" }, "
860849 + "{\" n4\" : \" boolean\" }, {\" n5\" : \" xx2\" }, {\" n4\" : \" boolean\" }]"
861850 );
862- result = runEsql (query );
863- colA = Map .of ("name" , "boolean" , "type" , "boolean" );
864- colB = Map .of ("name" , "xx2" , "type" , "double" );
865- assertEquals (List .of (colA , colB ), result .get ("columns" ));
866- assertEquals (List .of (List .of (false , 9.1 ), List .of (true , 8.1 )), result .get ("values" ));
851+ validateResultsOfDoubleParametersForIdentifiers (query );
867852
868853 query = requestObjectBuilder ().query (
869854 format (null , "from {} | eval x1 = ?? | where ?? == x1 | stats xx2 = ??(??) by ?? | keep ??, ?? | sort ??" , testIndexName ())
870855 ).params ("[\" integer\" , \" short\" , \" max\" , \" double\" , \" boolean\" , \" boolean\" , \" xx2\" , \" boolean\" ]" );
871- result = runEsql (query );
872- colA = Map .of ("name" , "boolean" , "type" , "boolean" );
873- colB = Map .of ("name" , "xx2" , "type" , "double" );
874- assertEquals (List .of (colA , colB ), result .get ("columns" ));
875- assertEquals (List .of (List .of (false , 9.1 ), List .of (true , 8.1 )), result .get ("values" ));
856+ validateResultsOfDoubleParametersForIdentifiers (query );
876857
877858 // missing params
878859 ResponseException re = expectThrows (
@@ -960,6 +941,14 @@ public void testDoubleParamsForIdentifiers() throws IOException {
960941 }
961942 }
962943
944+ private void validateResultsOfDoubleParametersForIdentifiers (RequestObjectBuilder query ) throws IOException {
945+ Map <String , Object > result = runEsql (query );
946+ Map <String , String > colA = Map .of ("name" , "boolean" , "type" , "boolean" );
947+ Map <String , String > colB = Map .of ("name" , "xx2" , "type" , "double" );
948+ assertEquals (List .of (colA , colB ), result .get ("columns" ));
949+ assertEquals (List .of (List .of (false , 9.1 ), List .of (true , 8.1 )), result .get ("values" ));
950+ }
951+
963952 public void testErrorMessageForLiteralDateMathOverflow () throws IOException {
964953 List <String > dateMathOverflowExpressions = List .of (
965954 "2147483647 day + 1 day" ,
0 commit comments