Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/compute/testdata/utf8.test

67 lines
4.2 KiB

#
# SUBSTR (compute.Substr) - case-sensitive substring matching
#
SUBSTR utf8:[] utf8:"test" -> bool:[]
SUBSTR utf8:["test"] utf8:"" -> bool:[true]
SUBSTR utf8:["test"] utf8:"test" -> bool:[true]
SUBSTR utf8:["test"] utf8:"notest" -> bool:[false]
SUBSTR utf8:["test"] utf8:"TEST" -> bool:[false]
SUBSTR utf8:[null] utf8:"test" -> bool:[null]
SUBSTR utf8:["test"] utf8:null -> bool:[null]
SUBSTR utf8:[null] utf8:null -> bool:[null]
#
# SUBSTRI (compute.SubstrInsensitive) - case-insensitive substring matching
#
SUBSTRI utf8:[] utf8:"test" -> bool:[]
SUBSTRI utf8:["test"] utf8:"" -> bool:[true]
SUBSTRI utf8:["test"] utf8:"test" -> bool:[true]
SUBSTRI utf8:["test"] utf8:"notest" -> bool:[false]
SUBSTRI utf8:["test"] utf8:"TEST" -> bool:[true]
SUBSTRI utf8:[null] utf8:"test" -> bool:[null]
SUBSTRI utf8:["test"] utf8:null -> bool:[null]
SUBSTRI utf8:[null] utf8:null -> bool:[null]
#
# REGEXP (compute.RegexpMatch) - second argument must be a scalar
#
REGEXP utf8:[] utf8:"test" -> bool:[]
REGEXP utf8:["test"] utf8:"" -> bool:[true]
REGEXP utf8:["test"] utf8:"test" -> bool:[true]
REGEXP utf8:["test"] utf8:"NOTtest" -> bool:[false]
REGEXP utf8:[null] utf8:"test" -> bool:[null]
REGEXP utf8:["test"] utf8:null -> bool:[null]
REGEXP utf8:[null] utf8:null -> bool:[null]
#
# Tests with selection vectors
#
# REGEXP with selection
REGEXP utf8:["foo" "bar" "baz" "qux" "test"] utf8:"ba." select:[true true true true true] -> bool:[false true true false false] # Full selection
REGEXP utf8:["foo" "bar" "baz" "qux" "test"] utf8:"ba." select:[true true true false false] -> bool:[false true true null null] # Partial (first three)
REGEXP utf8:["foo" "bar" "baz" "qux" "test"] utf8:"ba." select:[false true true true false] -> bool:[null true true false null] # Partial (middle)
REGEXP utf8:["foo" "bar" "baz" "qux" "test"] utf8:"ba." select:[false false false false false] -> bool:[null null null null null] # No selection
REGEXP utf8:["foo" "bar" "baz" "qux" "test"] utf8:"ba." select:[false false true false false] -> bool:[null null true null null] # Single row
# SUBSTRI with selection - case-insensitive
SUBSTRI utf8:["FOO" "BAR" "BAZ" "QUX" "TEST"] utf8:"ba" select:[true true true true true] -> bool:[false true true false false] # Full selection
SUBSTRI utf8:["FOO" "BAR" "BAZ" "QUX" "TEST"] utf8:"ba" select:[false false true true true] -> bool:[null null true false false] # Partial (last three)
SUBSTRI utf8:["FOO" "BAR" "BAZ" "QUX" "TEST"] utf8:"ba" select:[false false false false false] -> bool:[null null null null null] # No selection
SUBSTRI utf8:["FOO" "BAR" "BAZ" "QUX" "TEST"] utf8:"ba" select:[false true false false false] -> bool:[null true null null null] # Single row
SUBSTRI utf8:["FOO" "BAR" "BAZ" "QUX" "TEST"] utf8:"" select:[true false true false true] -> bool:[true null true null true] # Empty needle
SUBSTRI utf8:["FOO" "BAR" "BAZ" "QUX" "TEST"] utf8:null select:[true true false false true] -> bool:[null null null null null] # Null needle
# SUBSTR with selection - case-sensitive
SUBSTR utf8:["foo" "bar" "baz" "qux" "test"] utf8:"ba" select:[true true true true true] -> bool:[false true true false false] # Full selection
SUBSTR utf8:["foo" "bar" "baz" "qux" "test"] utf8:"ba" select:[true false true false true] -> bool:[false null true null false] # Partial (alternating)
SUBSTR utf8:["foo" "bar" "baz" "qux" "test"] utf8:"ba" select:[false false false false false] -> bool:[null null null null null] # No selection
SUBSTR utf8:["foo" "bar" "baz" "qux" "test"] utf8:"ba" select:[false true false false false] -> bool:[null true null null null] # Single row
SUBSTR utf8:["FOO" "BAR" "BAZ" "qux" "test"] utf8:"ba" select:[true true true false false] -> bool:[false false false null null] # Case-sensitive no match
SUBSTR utf8:["foo" "bar" "baz" "qux" "test"] utf8:"" select:[false true false true false] -> bool:[null true null true null] # Empty needle
SUBSTR utf8:["foo" "bar" "baz" "qux" "test"] utf8:null select:[true false true false true] -> bool:[null null null null null] # Null needle