@@ -6911,3 +6911,67 @@ def test_wildcard_operator_with_backslash(self):
69116911 )
69126912 assert response .status_code == 200 , response .data
69136913 assert response .data ["data" ] == [{"project.name" : self .project .slug , "id" : span ["span_id" ]}]
6914+
6915+ def test_in_query_matches_is_query_with_truncated_strings (self ) -> None :
6916+ self .store_spans (
6917+ [
6918+ self .create_span (
6919+ {"description" : "foo *" },
6920+ start_ts = self .ten_mins_ago ,
6921+ ),
6922+ ],
6923+ is_eap = True ,
6924+ )
6925+
6926+ is_query = self .do_request (
6927+ {
6928+ "field" : ["span.description" ],
6929+ "query" : 'span.description:"foo \\ *"' ,
6930+ "project" : self .project .id ,
6931+ "dataset" : "spans" ,
6932+ }
6933+ )
6934+ assert is_query .status_code == 200 , is_query .content
6935+
6936+ in_query = self .do_request (
6937+ {
6938+ "field" : ["span.description" ],
6939+ "query" : 'span.description:["foo \\ *"]' ,
6940+ "project" : self .project .id ,
6941+ "dataset" : "spans" ,
6942+ }
6943+ )
6944+ assert in_query .status_code == 200 , in_query .content
6945+ assert is_query .data ["data" ] == in_query .data ["data" ]
6946+
6947+ def test_in_query_with_numeric_values (self ) -> None :
6948+ span1 = self .create_span (
6949+ {"data" : {"ai_total_tokens_used" : 100 }},
6950+ start_ts = self .ten_mins_ago ,
6951+ )
6952+ span2 = self .create_span (
6953+ {"data" : {"ai_total_tokens_used" : 200 }},
6954+ start_ts = self .ten_mins_ago ,
6955+ )
6956+ span3 = self .create_span (
6957+ {"data" : {"ai_total_tokens_used" : 300 }},
6958+ start_ts = self .ten_mins_ago ,
6959+ )
6960+
6961+ self .store_spans ([span1 , span2 , span3 ], is_eap = True )
6962+
6963+ in_query = self .do_request (
6964+ {
6965+ "field" : ["id" , "ai.total_tokens.used" ],
6966+ "query" : "ai.total_tokens.used:[100, 200]" ,
6967+ "project" : self .project .id ,
6968+ "dataset" : "spans" ,
6969+ }
6970+ )
6971+ assert in_query .status_code == 200 , in_query .content
6972+ assert len (in_query .data ["data" ]) == 2
6973+
6974+ returned_ids = {row ["id" ] for row in in_query .data ["data" ]}
6975+ assert returned_ids == {span1 ["span_id" ], span2 ["span_id" ]}
6976+
6977+ assert span3 ["span_id" ] not in returned_ids
0 commit comments