@@ -519,11 +519,16 @@ public void testWildcardEscaping() throws IOException {
519519 // lucene escaping -> \\\\
520520 // rest request escaping -> \\\\\\\\
521521 // java string escaping ->\\\\\\\\
522+ String targetString = "\\ \" C:\\ \\ \\ \\ \\ \\ \\ \\ Users\\ \\ \\ \\ \\ \\ \\ \\ admin\\ \" " ;
523+ if (isCalciteEnabled () && !isPushdownDisabled ()) {
524+ targetString = "\\ \" C:\\ \\ \\ \\ Users\\ \\ \\ \\ admin\\ \" " ;
525+ }
522526 JSONObject backslashSearch =
523527 executeQuery (
524528 String .format (
525529 "search source=%s"
526- + " `attributes.error.type`=\\ \" C:\\ \\ \\ \\ \\ \\ \\ \\ Users\\ \\ \\ \\ \\ \\ \\ \\ admin\\ \" "
530+ + " `attributes.error.type`="
531+ + targetString
527532 + " | sort time | fields attributes.error.type" ,
528533 TEST_INDEX_OTEL_LOGS ));
529534 verifyDataRows (backslashSearch , rows ("C:\\ Users\\ admin" ));
@@ -712,20 +717,44 @@ public void testSearchWithUpperCaseValue() throws IOException {
712717
713718 @ Test
714719 public void testSearchWithInvalidFieldName () throws IOException {
715- JSONObject result =
716- executeQuery (
717- String .format (
718- "search source=%s nonexistent_field=\\ \" value\\ \" " , TEST_INDEX_OTEL_LOGS ));
719- verifyDataRows (result );
720+ if (!isPushdownDisabled () && isCalciteEnabled ()) {
721+ Throwable error =
722+ assertThrows (
723+ Exception .class ,
724+ () ->
725+ executeQuery (
726+ String .format (
727+ "search source=%s nonexistent_field=\\ \" value\\ \" " ,
728+ TEST_INDEX_OTEL_LOGS )));
729+ assertTrue (error .getMessage ().contains ("Field [nonexistent_field] not found." ));
730+ } else {
731+ JSONObject result =
732+ executeQuery (
733+ String .format (
734+ "search source=%s nonexistent_field=\\ \" value\\ \" " , TEST_INDEX_OTEL_LOGS ));
735+ verifyDataRows (result );
736+ }
720737 }
721738
722739 @ Test
723740 public void testSearchWithTypeMismatch () throws IOException {
724- JSONObject result =
725- executeQuery (
726- String .format (
727- "search source=%s severityNumber=\\ \" not-a-number\\ \" " , TEST_INDEX_OTEL_LOGS ));
728- verifyDataRows (result );
741+ if (!isPushdownDisabled () && isCalciteEnabled ()) {
742+ Throwable error =
743+ assertThrows (
744+ Exception .class ,
745+ () ->
746+ executeQuery (
747+ String .format (
748+ "search source=%s severityNumber=\\ \" not-a-number\\ \" " ,
749+ TEST_INDEX_OTEL_LOGS )));
750+ assertTrue (error .getMessage ().contains ("NumberFormatException" ));
751+ } else {
752+ JSONObject result =
753+ executeQuery (
754+ String .format (
755+ "search source=%s severityNumber=\\ \" not-a-number\\ \" " , TEST_INDEX_OTEL_LOGS ));
756+ verifyDataRows (result );
757+ }
729758 }
730759
731760 @ Test
0 commit comments