From cf8851ff091588b5676089775ddbb6098c2be744 Mon Sep 17 00:00:00 2001 From: Sri Krishna chowdary K Date: Sun, 17 Nov 2024 14:58:38 +0530 Subject: [PATCH] fix substrait signature mismatches in ported tests --- tests/cases/arithmetic/acosh.test | 2 +- tests/cases/arithmetic/atanh.test | 4 +- tests/cases/arithmetic/bitwise_and.test | 1 + tests/cases/arithmetic/bitwise_or.test | 2 +- tests/cases/arithmetic/bitwise_xor.test | 1 + tests/cases/arithmetic/divide.test | 1 - tests/cases/arithmetic/max.test | 2 +- tests/cases/arithmetic/min.test | 4 +- tests/cases/arithmetic/modulus.test | 2 +- tests/cases/arithmetic/sqrt.test | 3 +- tests/cases/arithmetic/sum.test | 14 ++--- .../cases/arithmetic_decimal/bitwise_and.test | 4 ++ .../arithmetic_decimal/factorial_decimal.test | 10 ++-- .../cases/arithmetic_decimal/max_decimal.test | 10 ++-- .../cases/arithmetic_decimal/min_decimal.test | 2 +- tests/cases/arithmetic_decimal/power.test | 8 ++- .../arithmetic_decimal/power_decimal.test | 10 ++-- .../arithmetic_decimal/sqrt_decimal.test | 26 +++++----- .../cases/arithmetic_decimal/sum_decimal.test | 2 +- tests/cases/boolean/bool_and.test | 3 +- tests/cases/comparison/between.test | 18 ++++--- tests/cases/comparison/gt.test | 4 +- tests/cases/comparison/gte.test | 4 +- tests/cases/comparison/is_not_null.test | 2 +- tests/cases/comparison/lt.test | 4 +- tests/cases/comparison/lte.test | 4 +- tests/cases/comparison/not_equal.test | 4 +- tests/cases/datetime/add_datetime.test | 2 +- tests/cases/datetime/add_intervals.test | 11 ++++ tests/cases/datetime/extract.test | 11 ++-- tests/cases/datetime/gt_datetime.test | 2 +- tests/cases/datetime/gte_datetime.test | 4 +- tests/cases/datetime/lt_datetime.test | 2 +- tests/cases/datetime/lte_datetime.test | 4 +- tests/cases/datetime/subtract_datetime.test | 8 +-- tests/cases/logarithmic/ln.test | 1 - tests/cases/logarithmic/log10.test | 1 - tests/cases/logarithmic/log2.test | 1 - tests/cases/string/contains.test | 2 + tests/cases/string/ends_with.test | 1 + tests/cases/string/like.test | 1 + tests/cases/string/ltrim.test | 14 ++--- .../cases/string/regexp_count_substring.test | 34 ++++++------ .../cases/string/regexp_match_substring.test | 38 +++++++------- tests/cases/string/regexp_replace.test | 52 +++++++++---------- tests/cases/string/regexp_string_split.test | 39 ++++++++++++++ tests/cases/string/rtrim.test | 14 ++--- tests/cases/string/starts_with.test | 1 + tests/cases/string/string_split.test | 9 ++++ tests/cases/string/trim.test | 14 ++--- tests/coverage/case_file_parser.py | 2 +- tests/test_extensions.py | 6 +-- 52 files changed, 244 insertions(+), 181 deletions(-) create mode 100644 tests/cases/datetime/add_intervals.test create mode 100644 tests/cases/string/regexp_string_split.test create mode 100644 tests/cases/string/string_split.test diff --git a/tests/cases/arithmetic/acosh.test b/tests/cases/arithmetic/acosh.test index 90064c9d4..fe352e150 100644 --- a/tests/cases/arithmetic/acosh.test +++ b/tests/cases/arithmetic/acosh.test @@ -8,5 +8,5 @@ acosh(null::fp64) = null::fp64 # On_domain_error: Examples demonstrating On_domain_error behavior acosh(0.01::fp32) [on_domain_error:ERROR] = -acosh(0.5::fp32) [on_domain_error:NAN] = nan::fp64 +acosh(0.5::fp64) [on_domain_error:NAN] = nan::fp64 acosh(0.5::fp32) [on_domain_error:NONE] = null::fp32 diff --git a/tests/cases/arithmetic/atanh.test b/tests/cases/arithmetic/atanh.test index 8d6fc94cb..676a4f917 100644 --- a/tests/cases/arithmetic/atanh.test +++ b/tests/cases/arithmetic/atanh.test @@ -4,6 +4,6 @@ # basic: Basic examples without any special cases atanh(0.0::fp32) = 0.0::fp32 atanh(1.0::fp64) = inf::fp64 -atanh(0.009::fp32) = 0.009000243011810481::fp64 -atanh(-0.009::fp32) = -0.009000243011810481::fp64 +atanh(0.009::fp64) = 0.009000243011810481::fp64 +atanh(-0.009::fp64) = -0.009000243011810481::fp64 atanh(null::fp64) = null::fp64 diff --git a/tests/cases/arithmetic/bitwise_and.test b/tests/cases/arithmetic/bitwise_and.test index 222fa1b6c..f90fef37a 100644 --- a/tests/cases/arithmetic/bitwise_and.test +++ b/tests/cases/arithmetic/bitwise_and.test @@ -12,3 +12,4 @@ bitwise_and(2147483647::i32, 1234567::i32) = 1234567::i32 bitwise_and(9223372036854775807::i64, 127::i64) = 127::i64 bitwise_and(-9223372036854775807::i64, 127::i64) = 1::i64 bitwise_and(null::i64, 127::i64) = null::i64 +bitwise_and(127::i64, null::i64) = null::i64 diff --git a/tests/cases/arithmetic/bitwise_or.test b/tests/cases/arithmetic/bitwise_or.test index 273f7979a..afc97d879 100644 --- a/tests/cases/arithmetic/bitwise_or.test +++ b/tests/cases/arithmetic/bitwise_or.test @@ -8,7 +8,7 @@ bitwise_or(-127::i8, -10::i8) = -9::i8 bitwise_or(31766::i16, 900::i16) = 32662::i16 bitwise_or(-31766::i16, 900::i16) = -31762::i16 bitwise_or(2147483647::i32, 123456789::i32) = 2147483647::i32 -bitwise_or(2147483647::i32, 123456789::i32) = 2147483647::i32 bitwise_or(9223372036854775807::i64, 127::i64) = 9223372036854775807::i64 bitwise_or(-9223372036854775807::i64, 127::i64) = -9223372036854775681::i64 bitwise_or(null::i64, 127::i64) = null::i64 +bitwise_or(127::i64, null::i64) = null::i64 diff --git a/tests/cases/arithmetic/bitwise_xor.test b/tests/cases/arithmetic/bitwise_xor.test index 838f99f71..f9c6a6285 100644 --- a/tests/cases/arithmetic/bitwise_xor.test +++ b/tests/cases/arithmetic/bitwise_xor.test @@ -12,3 +12,4 @@ bitwise_xor(2147483647::i32, 123456789::i32) = 2024026858::i32 bitwise_xor(9223372036854775807::i64, 127::i64) = 9223372036854775680::i64 bitwise_xor(-9223372036854775807::i64, 127::i64) = -9223372036854775682::i64 bitwise_xor(null::i64, 127::i64) = null::i64 +bitwise_xor(127::i64, null::i64) = null::i64 diff --git a/tests/cases/arithmetic/divide.test b/tests/cases/arithmetic/divide.test index 3d39224dc..fa5a7e7d9 100644 --- a/tests/cases/arithmetic/divide.test +++ b/tests/cases/arithmetic/divide.test @@ -10,7 +10,6 @@ divide(4000000000::i64, -5000::i64) = -800000::i64 # division_by_zero: Examples demonstrating division by zero divide(5::i8, 0::i8) [on_division_by_zero:NAN] = null::i8 divide(5::i8, 0::i8) [on_division_by_zero:ERROR] = -divide(5::i64, 0::i64) [on_division_by_zero:LIMIT] = inf::fp64 # overflow: Examples demonstrating overflow behavior divide(-9223372036854775808::i64, -1::i64) [overflow:ERROR] = diff --git a/tests/cases/arithmetic/max.test b/tests/cases/arithmetic/max.test index 2f3bc1a82..b52959b61 100644 --- a/tests/cases/arithmetic/max.test +++ b/tests/cases/arithmetic/max.test @@ -9,7 +9,7 @@ max((2000000000, -3217908979, 629000000, -100000000, 0, 987654321)::i64) = 20000 max((2.5, 0, 5.0, -2.5, -7.5)::fp32) = 5.0::fp32 max((1.5e+308, 1.5e+10, -1.5e+8, -1.5e+7, -1.5e+70)::fp64) = 1.5e+308::fp64 -# null_handling: Examples with null as unput or output +# null_handling: Examples with null as input or output max((Null, Null, Null)::i16) = Null::i16 max(()::i16) = Null::i16 max((2000000000, Null, 629000000, -100000000, Null, 987654321)::i64) = 2000000000::i64 diff --git a/tests/cases/arithmetic/min.test b/tests/cases/arithmetic/min.test index 132ec4b78..129aa2f85 100644 --- a/tests/cases/arithmetic/min.test +++ b/tests/cases/arithmetic/min.test @@ -8,9 +8,9 @@ min((-214748648, 214748647, 21470048, 4000000)::i32) = -214748648::i32 min((2000000000, -3217908979, 629000000, -100000000, 0, 987654321)::i64) = -3217908979::i64 min((2.5, 0, 5.0, -2.5, -7.5)::fp32) = -7.5::fp32 min((1.5e+308, 1.5e+10, -1.5e+8, -1.5e+7, -1.5e+70)::fp64) = -1.5e+70::fp64 -min((Null, inf)::fp64) = inf::fp64 -# null_handling: Examples with null as unput or output +# null_handling: Examples with null as input or output +min((Null, inf)::fp64) = inf::fp64 min((Null, Null, Null)::i16) = Null::i16 min(()::i16) = Null::i16 min((2000000000, Null, 629000000, -100000000, Null, 987654321)::i64) = -100000000::i64 diff --git a/tests/cases/arithmetic/modulus.test b/tests/cases/arithmetic/modulus.test index c9ab49166..4cdb9fc0d 100644 --- a/tests/cases/arithmetic/modulus.test +++ b/tests/cases/arithmetic/modulus.test @@ -12,7 +12,7 @@ modulus(null::i64, 1::i64) = null::i64 modulus(null::i64, null::i64) = null::i64 # on_domain_error: Examples demonstrating operation when the divisor is 0 -modulus(5::i8, 0::i8) [on_domain_error:null] = null::i8 +modulus(5::i8, 0::i8) [on_domain_error:NULL] = null::i8 modulus(5::i8, 0::i8) [on_domain_error:ERROR] = # division_type: Examples demonstrating truncate and floor division types diff --git a/tests/cases/arithmetic/sqrt.test b/tests/cases/arithmetic/sqrt.test index f1b90c4c3..293bdd5a4 100644 --- a/tests/cases/arithmetic/sqrt.test +++ b/tests/cases/arithmetic/sqrt.test @@ -4,8 +4,7 @@ # basic: Basic examples without any special cases sqrt(25::i64) = 5::fp64 sqrt(0::i64) = 0::fp64 -sqrt(-9223372036854775800::i64) [on_domain_error:NAN] = null::fp64 -sqrt(-9223372036854775800::i64) [on_domain_error:NAN] = null::fp64 +sqrt(-1::i64) [on_domain_error:NAN] = null::fp64 sqrt(-9223372036854775800::i64) [on_domain_error:NAN] = null::fp64 sqrt(9223372036854775800::i64) = 3037000499.97605::fp64 sqrt(null::i64) = null::fp64 diff --git a/tests/cases/arithmetic/sum.test b/tests/cases/arithmetic/sum.test index 50f0cd6ad..0021f3775 100644 --- a/tests/cases/arithmetic/sum.test +++ b/tests/cases/arithmetic/sum.test @@ -2,9 +2,9 @@ ### SUBSTRAIT_INCLUDE: '/extensions/functions_arithmetic.yaml' # basic: Basic examples without any special cases -sum((0, -1, 2, 20)::i8) = 21::i8 -sum((2000000, -3217908, 629000, -100000, 0, 987654)::i32) = 298746::i32 -sum((2.5, 0, 5.0, -2.5, -7.5)::fp32) = -2.5::fp32 +sum((0, -1, 2, 20)::i8) = 21::i64 +sum((2000000, -3217908, 629000, -100000, 0, 987654)::i32) = 298746::i64 +sum((2.5, 0, 5.0, -2.5, -7.5)::fp32) = -2.5::fp64 sum((2.5000007152557373046875, 7.0000007152557373046875, 0, 7.0000007152557373046875)::fp64) = 16.500002145767212::fp64 # overflow: Examples demonstrating overflow behavior @@ -16,7 +16,7 @@ sum((-1.5e+308, -1.5e+308, -1.5e+308)::fp64) = -inf::fp64 sum((2.500000715, inf, 2.500000715)::fp64) = inf::fp64 sum((2.5000007, -inf, 2.5000007, 10.0)::fp64) = -inf::fp64 -# null_handling: Examples with null as unput or output -sum((Null, Null, Null)::i16) = Null::i16 -sum(()::i16) = Null::i16 -sum((200000, Null, 629000, -10000, 0, 987621)::i32) = 1806621::i32 +# null_handling: Examples with null as input or output +sum((Null, Null, Null)::i16) = Null::i64 +sum(()::i16) = Null::i64 +sum((200000, Null, 629000, -10000, 0, 987621)::i32) = 1806621::i64 diff --git a/tests/cases/arithmetic_decimal/bitwise_and.test b/tests/cases/arithmetic_decimal/bitwise_and.test index 698e4a3be..ae5fdccde 100644 --- a/tests/cases/arithmetic_decimal/bitwise_and.test +++ b/tests/cases/arithmetic_decimal/bitwise_and.test @@ -16,3 +16,7 @@ bitwise_and(-9223372036854775807::dec<19, 0>, 127::dec<3, 0>) = 1::dec<19, 0> bitwise_and(99999999999999999999999999999999999999::dec<38, 0>, 99999999999999999999999999999999999999::dec<38, 0>) = 99999999999999999999999999999999999999::dec<38, 0> bitwise_and(99999999999999999999999999999999999999::dec<38, 0>, 00000000000000000000000000000000000000::dec<38, 0>) = 0::dec<38, 0> bitwise_and(-99999999999999999999999999999999999999::dec<38, 0>, -99999999999999999999999999999999999999::dec<38, 0>) = -99999999999999999999999999999999999999::dec<38, 0> + +# null_values: test with null values +bitwise_and(null::dec<1, 0>, 127::dec<3, 0>) = null::dec<3, 0> +bitwise_and(null::dec<1, 0>, null::dec<1, 0>) = null::dec<1, 0> diff --git a/tests/cases/arithmetic_decimal/factorial_decimal.test b/tests/cases/arithmetic_decimal/factorial_decimal.test index 19fc1d3d3..4e9560890 100644 --- a/tests/cases/arithmetic_decimal/factorial_decimal.test +++ b/tests/cases/arithmetic_decimal/factorial_decimal.test @@ -2,15 +2,15 @@ ### SUBSTRAIT_INCLUDE: '/extensions/functions_arithmetic_decimal.yaml' # basic: Basic examples without any special cases -factorial(0::dec<1,0>) = 1::dec<38,0> -factorial(1::dec<1,0>) = 1::dec<38,0> -factorial(20::dec<2,0>) = 2432902008176640000::dec<38,0> +factorial(0::dec<1, 0>) = 1::dec<38, 0> +factorial(1::dec<1, 0>) = 1::dec<38, 0> +factorial(20::dec<2, 0>) = 2432902008176640000::dec<38, 0> # overflow: Examples demonstrating overflow behavior -factorial(34::dec<2,0>) = +factorial(34::dec<2, 0>) = # negative_value: Examples demonstrating behavior on negative value -factorial(-1::dec<1,0>) = +factorial(-1::dec<1, 0>) = # null_values: test with null values factorial(null::dec<38, 0>) = null::dec<38, 0> diff --git a/tests/cases/arithmetic_decimal/max_decimal.test b/tests/cases/arithmetic_decimal/max_decimal.test index 86be47a34..f04d8a34a 100644 --- a/tests/cases/arithmetic_decimal/max_decimal.test +++ b/tests/cases/arithmetic_decimal/max_decimal.test @@ -9,10 +9,10 @@ max((2000000000, -3217908979, 629000000, -100000000, 0, 987654321)::dec<10, 0>) max((2.5, 0, 5.0, -2.5, -7.5)::dec<2, 1>) = 5.0::dec<2, 1> max((99999999999999999999999999999999999999, 0, -99999999999999999999999999999999999998, 111111111, -76)::dec<38, 0>) = 99999999999999999999999999999999999999::dec<38, 0> -# null_handling: Examples with null as unput or output -max((Null, Null, Null)::dec<1, 0>) = Null::dec<1, 0> -max(()::dec<1, 0>) = Null::dec<1, 0> +# null_handling: Examples with null as input or output +max((Null, Null, Null)::dec<1, 0>) = null::dec<1, 0> +max(()::dec<1, 0>) = null::dec<1, 0> max((2000000000, Null, 629000000, -100000000, Null, 987654321)::dec<10, 0>) = 2000000000::dec<10, 0> -max((Null, Null)::dec<1, 0>) = Null::dec<1, 0> -max(()::dec<1, 0>) = Null::dec<1, 0> +max((Null, Null)::dec<1, 0>) = null::dec<1, 0> +max(()::dec<1, 0>) = null::dec<1, 0> max((99999999999999999999999999999999999999, -99999999999999999999999999999999999998, Null, 11111111111111111111111111111111111111, Null)::dec<38, 0>) = 99999999999999999999999999999999999999::dec<38, 0> diff --git a/tests/cases/arithmetic_decimal/min_decimal.test b/tests/cases/arithmetic_decimal/min_decimal.test index bbbdd508a..7ecf5769f 100644 --- a/tests/cases/arithmetic_decimal/min_decimal.test +++ b/tests/cases/arithmetic_decimal/min_decimal.test @@ -9,7 +9,7 @@ min((2000000000, -3217908979, 629000000, -100000000, 0, 987654321)::dec<10, 0>) min((2.5, 0, 5.0, -2.5, -7.5)::dec<2, 1>) = -7.5::dec<2, 1> min((99999999999999999999999999999999999999, -99999999999999999999999999999999999998, -99999999999999999999999999999999999997, 0, 1111)::dec<38, 0>) = -99999999999999999999999999999999999998::dec<38, 0> -# null_handling: Examples with null as unput or output +# null_handling: Examples with null as input or output min((Null, Null, Null)::dec<1, 0>) = Null::dec<1, 0> min(()::dec<1, 0>) = Null::dec<1, 0> min((2000000000, Null, 629000000, -100000000, Null, 987654321)::dec<10, 0>) = -100000000::dec<10, 0> diff --git a/tests/cases/arithmetic_decimal/power.test b/tests/cases/arithmetic_decimal/power.test index 0d4889e0f..a3f0edc25 100644 --- a/tests/cases/arithmetic_decimal/power.test +++ b/tests/cases/arithmetic_decimal/power.test @@ -7,7 +7,7 @@ power(1.0::dec<38, 0>, -1.0::dec<38, 0>) = 1.0::fp64 power(2.0::dec<38, 0>, -2.0::dec<38, 0>) = 0.25::fp64 power(13::dec<38, 0>, 10::dec<38, 0>) = 137858491849::fp64 -# result_more_than_input_precison: Examples demonstrating result with more precision than input +# result_more_than_input_precision: Examples demonstrating result with more precision than input power(16::dec<2, 0>, 4::dec<38, 0>) = 65536::fp64 # floating_exception: Examples demonstrating exceptional floating point cases @@ -15,7 +15,5 @@ power(1.5e+10::dec<38, 0>, 1.5e+20::dec<38, 0>) = inf::fp64 power(-16::dec<4, 0>, 1001::dec<4, 0>) = -inf::fp64 # complex_number: Examples demonstrating complex number output -power(-1::dec, 0.5::dec<38,1>) [complex_number_result:NAN] = nan::fp64 - -# complex_number: Examples demonstrating complex number output tests: complex_number_result with ERROR -power(-1::dec, 0.5::dec<38,1>) [complex_number_result:ERROR] = +power(-1::dec, 0.5::dec<38, 1>) [complex_number_result:NAN] = nan::fp64 +power(-1::dec, 0.5::dec<38, 1>) [complex_number_result:ERROR] = diff --git a/tests/cases/arithmetic_decimal/power_decimal.test b/tests/cases/arithmetic_decimal/power_decimal.test index 386638335..cf82059c4 100644 --- a/tests/cases/arithmetic_decimal/power_decimal.test +++ b/tests/cases/arithmetic_decimal/power_decimal.test @@ -7,7 +7,7 @@ power(1.0::dec, -1.0::dec<38, 0>) = 1.0::fp64 power(2.0::dec<38, 0>, -2.0::dec<38, 0>) = 0.25::fp64 power(13::dec<38, 0>, 10::dec<38, 0>) = 137858491849::fp64 -# result_more_than_input_precison: Examples demonstrating result with more precision than input +# result_more_than_input_precision: Examples demonstrating result with more precision than input power(16::dec<2, 0>, 4::dec<38, 0>) = 65536::fp64 # floating_exception: Examples demonstrating exceptional floating point cases @@ -15,9 +15,9 @@ power(1.5e+10::dec<38, 0>, 1.5e+20::dec<38, 0>) = inf::fp64 power(-16::dec<4, 0>, 1001::dec<4, 0>) = -inf::fp64 # complex_number: Examples demonstrating complex number output -power(-1::dec, 0.5::dec<38,1>) [complex_number_result:NAN] = nan::fp64 -power(-1::dec, 0.5::dec<38,1>) [complex_number_result:ERROR] = +power(-1::dec, 0.5::dec<38, 1>) [complex_number_result:NAN] = nan::fp64 +power(-1::dec, 0.5::dec<38, 1>) [complex_number_result:ERROR] = # null_values: test with null values -power(null::dec<38, 0>, 127::dec<38, 0>) = null::dec<38, 0> -power(null::dec<38, 0>, null::dec<38, 0>) = null::dec<38, 0> +power(null::dec<38, 0>, 127::dec<38, 0>) = null::fp64 +power(null::dec<38, 0>, null::dec<38, 0>) = null::fp64 diff --git a/tests/cases/arithmetic_decimal/sqrt_decimal.test b/tests/cases/arithmetic_decimal/sqrt_decimal.test index a0c0dae0b..9214b4a3a 100644 --- a/tests/cases/arithmetic_decimal/sqrt_decimal.test +++ b/tests/cases/arithmetic_decimal/sqrt_decimal.test @@ -2,26 +2,26 @@ ### SUBSTRAIT_INCLUDE: '/extensions/functions_arithmetic_decimal.yaml' # basic: Basic examples without any special cases -sqrt(25::dec<2,0>) = 5::fp64 -sqrt(0::dec<1,0>) = 0::fp64 +sqrt(25::dec<2, 0>) = 5::fp64 +sqrt(0::dec<1, 0>) = 0::fp64 # max_input: max allowed input returns correct result -sqrt(99999999999999999999999999999999999999::dec<38,0>) = 1e+19::fp64 +sqrt(99999999999999999999999999999999999999::dec<38, 0>) = 1e+19::fp64 # real_number: real number as input -sqrt(6.25::dec<3,2>) = 2.5::fp64 -sqrt(2.0000007152557373046875::dec<23,22>) = 1.4142138152541635::fp64 +sqrt(6.25::dec<3, 2>) = 2.5::fp64 +sqrt(2.0000007152557373046875::dec<23, 22>) = 1.4142138152541635::fp64 -# verify_real_number: verify real number operation are different and doesn't behave as nearby int -sqrt(9::dec<1,0>) = 3::fp64 -sqrt(8.3::dec<2,1>) = 2.8809720581775866::fp64 -sqrt(8.5::dec<2,1>) = 2.9154759474226504::fp64 -sqrt(8.7::dec<2,1>) = 2.949576240750525::fp64 -sqrt(9.2::dec<2,1>) = 3.03315017762062::fp64 +# verify_real_number: verify real number operation are different and doesnt behave as nearby int +sqrt(9::dec<1, 0>) = 3::fp64 +sqrt(8.3::dec<2, 1>) = 2.8809720581775866::fp64 +sqrt(8.5::dec<2, 1>) = 2.9154759474226504::fp64 +sqrt(8.7::dec<2, 1>) = 2.949576240750525::fp64 +sqrt(9.2::dec<2, 1>) = 3.03315017762062::fp64 # negative_input: negative input returns error -sqrt(-9223372036854775800::dec<19,0>) = -sqrt(-2.5::dec<2,1>) = +sqrt(-9223372036854775800::dec<19, 0>) = +sqrt(-2.5::dec<2, 1>) = # null_values: test with null values sqrt(null::dec<38, 0>) = null::fp64 diff --git a/tests/cases/arithmetic_decimal/sum_decimal.test b/tests/cases/arithmetic_decimal/sum_decimal.test index af2eae936..cb257e32d 100644 --- a/tests/cases/arithmetic_decimal/sum_decimal.test +++ b/tests/cases/arithmetic_decimal/sum_decimal.test @@ -10,7 +10,7 @@ sum((2.5000007152557373046875, 7.0000007152557373046875, 0, 7.000000715255737304 # overflow: Examples demonstrating overflow behavior sum((99999999999999999999999999999999999999, 1, 1, 1, 1, 99999999999999999999999999999999999999)::dec<38, 0>) [overflow:ERROR] = -# null_handling: Examples with null as unput or output +# null_handling: Examples with null as input or output sum((Null, Null, Null)::dec<1, 0>) = Null::dec<38, 0> sum(()::dec<1, 0>) = Null::dec<38, 0> sum((200000, Null, 629000, -10000, 0, 987621)::dec<6, 0>) = 1806621::dec<38, 0> diff --git a/tests/cases/boolean/bool_and.test b/tests/cases/boolean/bool_and.test index 5297cbbd1..1fb0e67d5 100644 --- a/tests/cases/boolean/bool_and.test +++ b/tests/cases/boolean/bool_and.test @@ -1,10 +1,11 @@ -### SUBSTRAIT_AGGREGATE_TEST: v1.0 +### SUBSTRAIT_SCALAR_TEST: v1.0 ### SUBSTRAIT_INCLUDE: '/extensions/functions_boolean.yaml' # basic: Basic examples without any special cases bool_and((true, true)::bool) = true::bool bool_and((true, false)::bool) = false::bool bool_and((false, false)::bool) = false::bool +bool_and((false)::bool) = false::bool bool_and((true)::bool) = true::bool bool_and((true, null)::bool) = true::bool bool_and((null, null)::bool) = null::bool diff --git a/tests/cases/comparison/between.test b/tests/cases/comparison/between.test index d4f34c124..6c3d66fdb 100644 --- a/tests/cases/comparison/between.test +++ b/tests/cases/comparison/between.test @@ -6,14 +6,16 @@ between(5::i8, 0::i8, 127::i8) = true::bool between(20000::i16, 1::i16, 30000::i16) = true::bool between(1030000000::i32, 1000000000::i32, 2000000000::i32) = true::bool between(10300000000900::i64, 1000000000::i64, 9223372036854775807::i64) = true::bool -between(2::i8, 1::i8, -120::i8) = False::bool -between(-10000::i16, -20000::i16, -30000::i16) = False::bool -between(-100000000::i32, -1000000000::i32, -2000000000::i32) = False::bool -between(92233720368547758::i64, 1::i64, -9223372036854775807::i64) = False::bool -between(14.01::fp32, 20.90::fp32, 88.00::fp32) = False::bool -between(14.011::fp64, 0.00::fp64, inf::fp64) = True::bool -between(inf::fp64, 0.00::fp64, 100.09::fp64) = False::bool -between(-100.0011::fp64, -inf::fp64, 0.00::fp64) = True::bool +between(2::i8, 1::i8, -120::i8) = false::bool +between(2::i8, 2::i8, 3::i8) = true::bool +between(2::i8, 1::i8, 2::i8) = true::bool +between(-10000::i16, -20000::i16, -30000::i16) = false::bool +between(-100000000::i32, -1000000000::i32, -2000000000::i32) = false::bool +between(92233720368547758::i64, 1::i64, -9223372036854775807::i64) = false::bool +between(14.01::fp32, 20.90::fp32, 88.00::fp32) = false::bool +between(14.011::fp64, 0.00::fp64, inf::fp64) = true::bool +between(inf::fp64, 0.00::fp64, 100.09::fp64) = false::bool +between(-100.0011::fp64, -inf::fp64, 0.00::fp64) = true::bool # null_input: Examples with null as input between(null::i8, 1::i8, 10::i8) = null::bool diff --git a/tests/cases/comparison/gt.test b/tests/cases/comparison/gt.test index 946fbf9da..3c981abc4 100644 --- a/tests/cases/comparison/gt.test +++ b/tests/cases/comparison/gt.test @@ -11,10 +11,10 @@ gt(7.25::fp32, 2.50::fp32) = true::bool gt(-922337203685775808::dec<38, 0>, -922337203685775807::dec<38, 0>) = false::bool gt(7.25::dec<38, 2>, 2.50::dec<38, 2>) = true::bool gt(-1.5e+308::fp64, -inf::fp64) = true::bool -gt(null::i16, 100::i16) = null::bool +gt(inf::fp64, 1.5e+308::fp64) = true::bool # null_input: Examples with null as input -gt(inf::fp64, 1.5e+308::fp64) = true::bool +gt(null::i16, 100::i16) = null::bool gt(2::i16, null::i16) = null::bool gt(null::i16, null::i16) = null::bool gt(2::dec<38, 2>, null::dec<38, 2>) = null::bool diff --git a/tests/cases/comparison/gte.test b/tests/cases/comparison/gte.test index a11522e00..a0ab6d538 100644 --- a/tests/cases/comparison/gte.test +++ b/tests/cases/comparison/gte.test @@ -14,10 +14,10 @@ gte(7.25::dec<38, 2>, 7.27::dec<38, 2>) = false::bool gte(inf::fp64, 1.5e+308::fp64) = true::bool gte(inf::fp64, inf::fp64) = true::bool gte(-inf::fp64, -1.5e+308::fp64) = false::bool -gte(null::dec<38, 2>, 7.25::dec<38, 2>) = null::bool -gte(null::dec<38, 2>, null::dec<38, 2>) = null::bool # null_input: Examples with null as input +gte(null::dec<38, 2>, 7.25::dec<38, 2>) = null::bool +gte(null::dec<38, 2>, null::dec<38, 2>) = null::bool gte(null::i16, 1::i16) = null::bool gte(2::i16, null::i16) = null::bool gte(null::i16, null::i16) = null::bool diff --git a/tests/cases/comparison/is_not_null.test b/tests/cases/comparison/is_not_null.test index 0ddc8b025..2a21c5967 100644 --- a/tests/cases/comparison/is_not_null.test +++ b/tests/cases/comparison/is_not_null.test @@ -6,5 +6,5 @@ is_not_null(25::i16) = true::bool is_not_null(true::bool) = true::bool is_not_null(7.25::fp32) = true::bool is_not_null(7.25::dec<38, 3>) = true::bool -is_not_null(null::i8) = False::bool +is_not_null(null::i8) = false::bool is_not_null(null::dec<38, 3>) = false::bool diff --git a/tests/cases/comparison/lt.test b/tests/cases/comparison/lt.test index 8496fdd6a..60cc92020 100644 --- a/tests/cases/comparison/lt.test +++ b/tests/cases/comparison/lt.test @@ -12,10 +12,10 @@ lt(7.25::dec<38, 2>, 7.25::dec<38, 2>) = false::bool lt(2.49::dec<38, 2>, 2.50::dec<38, 2>) = true::bool lt(1.5e+308::fp64, inf::fp64) = true::bool lt(-1.5e+308::fp64, -inf::fp64) = false::bool -lt(null::dec<38, 2>, 2.50::dec<38, 2>) = null::bool -lt(null::dec<38, 2>, null::dec<38, 2>) = null::bool # null_input: Examples with null as input +lt(null::dec<38, 2>, 2.50::dec<38, 2>) = null::bool +lt(null::dec<38, 2>, null::dec<38, 2>) = null::bool lt(null::i16, 1::i16) = null::bool lt(2::i16, null::i16) = null::bool lt(null::i16, null::i16) = null::bool diff --git a/tests/cases/comparison/lte.test b/tests/cases/comparison/lte.test index 294a9d45f..79839d94e 100644 --- a/tests/cases/comparison/lte.test +++ b/tests/cases/comparison/lte.test @@ -14,10 +14,10 @@ lte(2.59::dec<38, 2>, 2.50::dec<38, 2>) = false::bool lte(1.5e+308::fp64, inf::fp64) = true::bool lte(inf::fp64, inf::fp64) = true::bool lte(-1.5e+308::fp64, -inf::fp64) = false::bool -lte(null::dec<38, 2>, 2.50::dec<38, 2>) = null::bool -lte(null::dec<38, 2>, null::dec<38, 2>) = null::bool # null_input: Examples with null as input +lte(null::dec<38, 2>, 2.50::dec<38, 2>) = null::bool +lte(null::dec<38, 2>, null::dec<38, 2>) = null::bool lte(null::i16, 1::i16) = null::bool lte(2::i16, null::i16) = null::bool lte(null::i16, null::i16) = null::bool diff --git a/tests/cases/comparison/not_equal.test b/tests/cases/comparison/not_equal.test index 4bb927110..78bfe4a2d 100644 --- a/tests/cases/comparison/not_equal.test +++ b/tests/cases/comparison/not_equal.test @@ -11,9 +11,9 @@ not_equal(9223372036854775804::dec<38, 0>, 9223372036854775804::dec<38, 0>) = fa not_equal(inf::fp64, inf::fp64) = false::bool not_equal(inf::fp64, 1.5e+308::fp64) = true::bool not_equal(inf::fp64, -inf::fp64) = true::bool -not_equal(null::dec<38, 2>, 2.50::dec<38, 2>) = null::bool -not_equal(null::dec<38, 2>, null::dec<38, 2>) = null::bool # null_input: Examples with null as input +not_equal(null::dec<38, 2>, 2.50::dec<38, 2>) = null::bool +not_equal(null::dec<38, 2>, null::dec<38, 2>) = null::bool not_equal(null::i16, 1::i16) = null::bool not_equal(null::i16, null::i16) = null::bool diff --git a/tests/cases/datetime/add_datetime.test b/tests/cases/datetime/add_datetime.test index 92694d49b..ea6fe78b4 100644 --- a/tests/cases/datetime/add_datetime.test +++ b/tests/cases/datetime/add_datetime.test @@ -12,4 +12,4 @@ add('2020-12-31'::date, 'P5Y'::iyear) = '2025-12-31T00:00:00'::ts add('2020-12-31'::date, 'P5M'::iyear) = '2021-05-31T00:00:00'::ts # null_input: examples with null args or return -add(null::date, 'P5D'::iday) = null::date +add(null::date, 'P5D'::iday) = null::ts diff --git a/tests/cases/datetime/add_intervals.test b/tests/cases/datetime/add_intervals.test new file mode 100644 index 000000000..3f59d24cd --- /dev/null +++ b/tests/cases/datetime/add_intervals.test @@ -0,0 +1,11 @@ +### SUBSTRAIT_SCALAR_TEST: v1.0 +### SUBSTRAIT_INCLUDE: '/extensions/functions_datetime.yaml' + +# basic: Basic examples without any special cases +add_intervals('PT10H'::iday, 'PT5H'::iday) = 'P0DT15H0M0S'::iday +add_intervals('P10D'::iday, 'P5D'::iday) = 'P15D'::iday +add_intervals('P1D'::iday, 'PT10H'::iday) = 'P1DT10H0M0S'::iday + +# null_input: Basic examples where the input args or return is null +add_intervals(null::iyear, 'P1Y'::iyear) = null::iyear +add_intervals(null::iday, 'P1D'::iday) = null::iday diff --git a/tests/cases/datetime/extract.test b/tests/cases/datetime/extract.test index c78a7966b..80fe6f09b 100644 --- a/tests/cases/datetime/extract.test +++ b/tests/cases/datetime/extract.test @@ -12,13 +12,10 @@ extract('ISODOW'::str, '2016-12-25T13:30:15'::ts) = 7::i64 extract('DOW'::str, '2016-12-25T13:30:15'::ts) = 0::i64 extract('DOY'::str, '2016-12-25T13:30:15'::ts) = 360::i64 extract('HOUR'::str, '2016-12-31T13:30:15'::ts) = 13::i64 -extract('HOUR'::str, '1999-01-08T04:05:06-08:00'::tstz) = 12::i64 -extract('HOUR'::str, '2016-12-31T13:30:15-10:00'::tstz) = 23::i64 extract('MINUTE'::str, '2016-12-31T13:30:15'::ts) = 30::i64 extract('SECOND'::str, '2016-12-31T13:30:15'::ts) = 15::i64 extract('MILLISECONDS'::str, '2016-12-31T13:30:15'::ts) = 15000::i64 extract('MICROSECONDS'::str, '2016-12-31T13:30:15.220000'::ts) = 15220000::i64 -extract('TIMEZONE'::str, '1999-01-08T04:05:06-08:00'::tstz) = 0::i64 extract('EPOCH'::str, '2016-12-31T13:30:15'::ts) = 1483191015::i64 # date: examples using the date type @@ -27,8 +24,8 @@ extract('MONTH'::str, '2020-12-31'::date) = 12::i64 extract('DAY'::str, '2020-12-31'::date) = 31::i64 # time: examples using the time type -extract('HOUR'::str, '01:02:03.155900'::time) = 1::i64 -extract('MINUTE'::str, '01:02:03.155900'::time) = 2::i64 -extract('SECOND'::str, '01:02:03.155900'::time) = 3::i64 -extract('MILLISECOND'::str, '01:02:03.155900'::time) = 3000::i64 +extract('HOUR'::str, '01:02:03'::time) = 1::i64 +extract('MINUTE'::str, '01:02:03'::time) = 2::i64 +extract('SECOND'::str, '01:02:03'::time) = 3::i64 +extract('MILLISECOND'::str, '01:02:03.155'::time) = 3155::i64 extract('MICROSECOND'::str, '01:02:03.45'::time) = 3450000::i64 diff --git a/tests/cases/datetime/gt_datetime.test b/tests/cases/datetime/gt_datetime.test index 5c30851a9..f96d369c5 100644 --- a/tests/cases/datetime/gt_datetime.test +++ b/tests/cases/datetime/gt_datetime.test @@ -12,9 +12,9 @@ gt('1999-01-08T01:05:07-08:00'::tstz, '1999-01-08T04:05:06-05:00'::tstz) = true: # date: examples using the date type gt('2020-12-30'::date, '2020-12-31'::date) = false::bool gt('2020-12-31'::date, '2020-12-30'::date) = true::bool -gt('P7D'::iday, 'P6D'::iday) = true::bool # interval: examples using the interval type +gt('P7D'::iday, 'P6D'::iday) = true::bool gt('P5D'::iday, 'P6D'::iday) = false::bool gt('P5Y'::iyear, 'P6Y'::iyear) = false::bool gt('P7Y'::iyear, 'P6Y'::iyear) = true::bool diff --git a/tests/cases/datetime/gte_datetime.test b/tests/cases/datetime/gte_datetime.test index a1497c843..7762de720 100644 --- a/tests/cases/datetime/gte_datetime.test +++ b/tests/cases/datetime/gte_datetime.test @@ -15,10 +15,10 @@ gte('1999-01-08T01:05:06-08:00'::tstz, '1999-01-08T04:05:05-05:00'::tstz) = true gte('2020-12-30'::date, '2020-12-31'::date) = false::bool gte('2020-12-31'::date, '2020-12-31'::date) = true::bool gte('2020-12-31'::date, '2020-12-30'::date) = true::bool -gte('P7D'::iday, 'P7D'::iday) = true::bool -gte('P7D'::iday, 'P6D'::iday) = true::bool # interval: examples using the interval type +gte('P7D'::iday, 'P7D'::iday) = true::bool +gte('P7D'::iday, 'P6D'::iday) = true::bool gte('P5D'::iday, 'P6D'::iday) = false::bool gte('P5Y'::iyear, 'P6Y'::iyear) = false::bool gte('P7Y'::iyear, 'P7Y'::iyear) = true::bool diff --git a/tests/cases/datetime/lt_datetime.test b/tests/cases/datetime/lt_datetime.test index fa0d9bce6..a2c14c44d 100644 --- a/tests/cases/datetime/lt_datetime.test +++ b/tests/cases/datetime/lt_datetime.test @@ -12,9 +12,9 @@ lt('1999-01-08T01:05:06-08:00'::tstz, '1999-01-08T04:05:06-05:00'::tstz) = false # date: examples using the date type lt('2020-12-30'::date, '2020-12-31'::date) = true::bool lt('2020-12-31'::date, '2020-12-30'::date) = false::bool -lt('P7D'::iday, 'P6D'::iday) = false::bool # interval: examples using the interval type +lt('P7D'::iday, 'P6D'::iday) = false::bool lt('P5D'::iday, 'P6D'::iday) = true::bool lt('P5Y'::iyear, 'P6Y'::iyear) = true::bool lt('P7Y'::iyear, 'P6Y'::iyear) = false::bool diff --git a/tests/cases/datetime/lte_datetime.test b/tests/cases/datetime/lte_datetime.test index da5e85145..38e4adbce 100644 --- a/tests/cases/datetime/lte_datetime.test +++ b/tests/cases/datetime/lte_datetime.test @@ -15,10 +15,10 @@ lte('1999-01-08T01:05:06-08:00'::tstz, '1999-01-08T04:05:05-05:00'::tstz) = fals lte('2020-12-30'::date, '2020-12-31'::date) = true::bool lte('2020-12-31'::date, '2020-12-31'::date) = true::bool lte('2020-12-31'::date, '2020-12-30'::date) = false::bool -lte('P7D'::iday, 'P7D'::iday) = true::bool -lte('P7D'::iday, 'P6D'::iday) = false::bool # interval: examples using the interval type +lte('P7D'::iday, 'P7D'::iday) = true::bool +lte('P7D'::iday, 'P6D'::iday) = false::bool lte('P5D'::iday, 'P6D'::iday) = true::bool lte('P5Y'::iyear, 'P6Y'::iyear) = true::bool lte('P7Y'::iyear, 'P7Y'::iyear) = true::bool diff --git a/tests/cases/datetime/subtract_datetime.test b/tests/cases/datetime/subtract_datetime.test index 9cc87c9b9..1b0eb631c 100644 --- a/tests/cases/datetime/subtract_datetime.test +++ b/tests/cases/datetime/subtract_datetime.test @@ -6,10 +6,10 @@ subtract('2016-12-31T13:30:15'::ts, 'P5D'::iday) = '2016-12-26T13:30:15'::ts subtract('2016-12-01T13:30:15'::ts, 'P5Y'::iyear) = '2011-12-01T13:30:15'::ts subtract('2016-12-01T13:30:15'::ts, 'PT5H'::iday) = '2016-12-01T08:30:15'::ts -# date_to_timestamp: examples using the date types and resulting in a timestamp -subtract('2020-12-31'::date, 'P5D'::iday) = '2020-12-26T00:00:00'::ts -subtract('2020-12-31'::date, 'P5Y'::iyear) = '2015-12-31T00:00:00'::ts -subtract('2020-12-31'::date, 'P5M'::iyear) = '2020-07-31T00:00:00'::ts +# date: examples using the date type +subtract('2020-12-31'::date, 'P5D'::iday) = '2020-12-26'::date +subtract('2020-12-31'::date, 'P5Y'::iyear) = '2015-12-31'::date +subtract('2020-12-31'::date, 'P5M'::iyear) = '2020-07-31'::date # null_input: examples with null args or return subtract(null::date, 'P5D'::iday) = null::date diff --git a/tests/cases/logarithmic/ln.test b/tests/cases/logarithmic/ln.test index 428d17600..fcfc40ff4 100644 --- a/tests/cases/logarithmic/ln.test +++ b/tests/cases/logarithmic/ln.test @@ -5,7 +5,6 @@ ln(100000::i64) = 11.512925464970229::fp64 ln(1.0::fp32) = 0::fp32 ln(2.015::fp64) = 0.7006191953986464::fp64 -ln(inf::fp64) = inf::fp64 # infinity: Examples with infinity as input ln(-inf::fp64) [on_domain_error:ERROR] = diff --git a/tests/cases/logarithmic/log10.test b/tests/cases/logarithmic/log10.test index 811a24790..347d0bf66 100644 --- a/tests/cases/logarithmic/log10.test +++ b/tests/cases/logarithmic/log10.test @@ -5,7 +5,6 @@ log10(100000::i64) = 5.0::fp64 log10(1.0::fp32) = 0::fp32 log10(2.015::fp64) = 0.3042750504771283::fp64 -log10(inf::fp64) = inf::fp64 # infinity: Examples with infinity as input log10(-inf::fp64) [on_domain_error:ERROR] = diff --git a/tests/cases/logarithmic/log2.test b/tests/cases/logarithmic/log2.test index 0403260d6..896ede9da 100644 --- a/tests/cases/logarithmic/log2.test +++ b/tests/cases/logarithmic/log2.test @@ -6,7 +6,6 @@ log2(100000::i64) = 16.609640474436812::fp64 log2(1.0::fp32) = 0::fp32 log2(8.0::fp64) = 3.0::fp64 log2(2.015::fp64) = 1.0107798387532427::fp64 -log2(inf::fp64) = inf::fp64 # infinity: Examples with infinity as input log2(-inf::fp64) [on_domain_error:ERROR] = diff --git a/tests/cases/string/contains.test b/tests/cases/string/contains.test index 92d7338ef..7994e7ecd 100644 --- a/tests/cases/string/contains.test +++ b/tests/cases/string/contains.test @@ -3,6 +3,7 @@ # basic: Basic examples contains as prefix contains('abcdefg'::str, 'abc'::str) = true::bool +contains('abcdefg'::str, 'CdE'::str) = false::bool contains('abcdefg'::str, 'CdE'::str) [case_sensitivity:CASE_INSENSITIVE] = true::bool contains('abcdefg'::str, 'cde'::str) = true::bool contains('abcdefg'::str, 'fg'::str) = true::bool @@ -10,5 +11,6 @@ contains('abcdefg'::str, 'aef'::str) = false::bool # multi_byte_characters: multi byte characters exists in the string contains('😊a😊b😊😊'::str, 'a😊b'::str) = true::bool +contains('😊a😊b😊😊'::str, 'A😊B'::str) = false::bool contains('😊a😊b😊😊'::str, 'A😊B'::str) [case_sensitivity:CASE_INSENSITIVE] = true::bool contains('😊a😊b😊😊'::str, 'a😊c'::str) = false::bool diff --git a/tests/cases/string/ends_with.test b/tests/cases/string/ends_with.test index aa4dbbe03..bef86918f 100644 --- a/tests/cases/string/ends_with.test +++ b/tests/cases/string/ends_with.test @@ -4,6 +4,7 @@ # basic: Basic examples without any special cases ends_with('abcd'::str, 'd'::str) = true::bool ends_with('abcd'::str, 'a'::str) = false::bool +ends_with('abcd'::str, 'CD'::str) = false::bool # case_insenstivity: multi byte character comparison with case insensitivity ends_with('abcd'::str, 'CD'::str) [case_sensitivity:CASE_INSENSITIVE] = true::bool diff --git a/tests/cases/string/like.test b/tests/cases/string/like.test index c01003fb3..03e89ea64 100644 --- a/tests/cases/string/like.test +++ b/tests/cases/string/like.test @@ -4,6 +4,7 @@ # basic: Basic examples without any special cases like('abcdefg'::str, 'abcdefg'::str) = true::bool like('abcdefg'::str, 'abc'::str) = false::bool +like('abcdefg'::str, 'ABCDEFG'::str) = false::bool # wildcard: Examples using wildcards like('abcdefg'::str, 'abc%'::str) = true::bool diff --git a/tests/cases/string/ltrim.test b/tests/cases/string/ltrim.test index 7eb9728fa..53a2f495f 100644 --- a/tests/cases/string/ltrim.test +++ b/tests/cases/string/ltrim.test @@ -2,13 +2,13 @@ ### SUBSTRAIT_INCLUDE: '/extensions/functions_string.yaml' # basic: Basic examples without any special cases -ltrim('abc'::str) = 'abc'::str -ltrim(' abc'::str) = 'abc'::str -ltrim('abc '::str) = 'abc '::str -ltrim(' abc '::str) = 'abc '::str -ltrim(''::str) = ''::str -ltrim(' '::str) = ''::str -ltrim(null::str) = null::str +ltrim('abc'::str, ' '::str) = 'abc'::str +ltrim(' abc'::str, ' '::str) = 'abc'::str +ltrim('abc '::str, ' '::str) = 'abc '::str +ltrim(' abc '::str, ' '::str) = 'abc '::str +ltrim(''::str, ' '::str) = ''::str +ltrim(' '::str, ' '::str) = ''::str +ltrim(null::str, ' '::str) = null::str # two_inputs: Examples with character input to trim off ltrim('aaaaabc'::str, 'a'::str) [spaces_only:FALSE] = 'bc'::str diff --git a/tests/cases/string/regexp_count_substring.test b/tests/cases/string/regexp_count_substring.test index 67778734f..bd4f1081f 100644 --- a/tests/cases/string/regexp_count_substring.test +++ b/tests/cases/string/regexp_count_substring.test @@ -2,32 +2,32 @@ ### SUBSTRAIT_INCLUDE: '/extensions/functions_string.yaml' # basic: Basic examples without any special cases -regexp_count_substring('foobarboopzoo'::str, 'o{1,}'::str) = 3::i64 -regexp_count_substring('foobarboopzoo'::str, 'o{1}'::str) = 6::i64 -regexp_count_substring('abcabcacb'::str, '[bc]'::str) = 6::i64 -regexp_count_substring('abcdefc'::str, '(.*)c'::str) = 1::i64 -regexp_count_substring('abcdefc'::str, '(.*)c?'::str) = 2::i64 +regexp_count_substring('foobarboopzoo'::str, 'o{1,}'::str, 1::i64) = 3::i64 +regexp_count_substring('foobarboopzoo'::str, 'o{1}'::str, 1::i64) = 6::i64 +regexp_count_substring('abcabcacb'::str, '[bc]'::str, 1::i64) = 6::i64 +regexp_count_substring('abcdefc'::str, '(.*)c'::str, 1::i64) = 1::i64 +regexp_count_substring('abcdefc'::str, '(.*)c?'::str, 1::i64) = 2::i64 # null_input: Examples with null as input -regexp_count_substring('Hello'::str, null::str) = null::i64 -regexp_count_substring(null::str, ' '::str) = null::i64 +regexp_count_substring('Hello'::str, null::str, 1::i64) = null::i64 +regexp_count_substring(null::str, ' '::str, 1::i64) = null::i64 # metacharacters: Examples with metacharacters -regexp_count_substring('abc1abc'::str, '\d'::str) = 1::i64 -regexp_count_substring('abc1abc'::str, '\D'::str) = 6::i64 -regexp_count_substring('abc def ghi'::str, '\s'::str) = 2::i64 -regexp_count_substring('abc def ghi'::str, '\S'::str) = 9::i64 -regexp_count_substring('abc def ghi'::str, '\w'::str) = 9::i64 -regexp_count_substring('abc def ghi,'::str, '\W'::str) = 3::i64 +regexp_count_substring('abc1abc'::str, '\d'::str, 1::i64) = 1::i64 +regexp_count_substring('abc1abc'::str, '\D'::str, 1::i64) = 6::i64 +regexp_count_substring('abc def ghi'::str, '\s'::str, 1::i64) = 2::i64 +regexp_count_substring('abc def ghi'::str, '\S'::str, 1::i64) = 9::i64 +regexp_count_substring('abc def ghi'::str, '\w'::str, 1::i64) = 9::i64 +regexp_count_substring('abc def ghi,'::str, '\W'::str, 1::i64) = 3::i64 # lookahead: Examples with lookahead -regexp_count_substring('100 dollars 100 dollars'::str, '\d+(?= dollars)'::str) [lookaround:TRUE] = 2::i64 +regexp_count_substring('100 dollars 100 dollars'::str, '\d+(?= dollars)'::str, 1::i64) [lookaround:TRUE] = 2::i64 # negative_lookahead: Examples with negative lookahead -regexp_count_substring('100 pesos, 99 pesos, 98 pesos'::str, '\d+(?!\d| dollars)'::str) [lookaround:TRUE] = 3::i64 +regexp_count_substring('100 pesos, 99 pesos, 98 pesos'::str, '\d+(?!\d| dollars)'::str, 1::i64) [lookaround:TRUE] = 3::i64 # lookbehind: Examples with lookbehind -regexp_count_substring('USD100'::str, '(?<=USD)\d{3}'::str) [lookaround:TRUE] = 1::i64 +regexp_count_substring('USD100'::str, '(?<=USD)\d{3}'::str, 1::i64) [lookaround:TRUE] = 1::i64 # negative_lookbehind: Examples with negative lookbehind -regexp_count_substring('JPY100JPY100'::str, '\d{3}(? +regexp_string_split('Hello'::str, 'Hel+'::str) = ['', 'o']::list + +# greedy_matching: Examples with greedy matching +regexp_string_split('HHHelloooo'::str, 'Hel+'::str) = ['HH', 'oooo']::list + +# position_anchors: Examples with position anchors +regexp_string_split('abcdefg'::str, '\Aabc'::str) = ['', 'defg']::list +regexp_string_split('abcdefg'::str, 'efg$'::str) = ['abcd', '']::list + +# metacharacters: Examples with metacharacters +regexp_string_split('abc1abc'::str, '\d'::str) = ['abc', 'abc']::list +regexp_string_split('111a111'::str, '\D'::str) = ['111', '111']::list +regexp_string_split('abc def'::str, '\s'::str) = ['abc', 'def']::list +regexp_string_split('a bcdef'::str, '\S'::str) = ['', ' ', '', '', '', '', '']::list +regexp_string_split(' abcdef'::str, '\w'::str) = [' ', '', '', '', '', '', '']::list +regexp_string_split('a bcdef'::str, '\W'::str) = ['a', 'bcdef']::list + +# occurrence_indicator: Examples with occurrence indicators +regexp_string_split('abc123abc'::str, '[0-9]+'::str) = ['abc', 'abc']::list +regexp_string_split('abc123abc'::str, '[bc]'::str) = ['a', '', '123a', '', '']::list +regexp_string_split('abcde'::str, '(.*)c'::str) = ['', 'de']::list +regexp_string_split('abbbbc'::str, '[b]{2,3}'::str) = ['a', 'bc']::list + +# lookahead: Examples with lookahead +regexp_string_split('100 dollars'::str, '\d+(?= dollars)'::str) [lookaround:TRUE] = ['', ' dollars']::list + +# negative_lookahead: Examples with negative lookahead +regexp_string_split('100 pesos'::str, '\d+(?!\d| dollars)'::str) [lookaround:TRUE] = ['', ' pesos']::list + +# lookbehind: Examples with lookbehind +regexp_string_split('USD100'::str, '(?<=USD)\d{3}'::str) [lookaround:TRUE] = ['USD', '']::list + +# negative_lookbehind: Examples with negative lookbehind +regexp_string_split('JPY100'::str, '\d{3}(? diff --git a/tests/cases/string/rtrim.test b/tests/cases/string/rtrim.test index 7d0ae6a87..0a9d5a5b0 100644 --- a/tests/cases/string/rtrim.test +++ b/tests/cases/string/rtrim.test @@ -2,13 +2,13 @@ ### SUBSTRAIT_INCLUDE: '/extensions/functions_string.yaml' # basic: Basic examples without any special cases -rtrim('abc'::str) = 'abc'::str -rtrim(' abc'::str) = ' abc'::str -rtrim('abc '::str) = 'abc'::str -rtrim(' abc '::str) = ' abc'::str -rtrim(''::str) = ''::str -rtrim(' '::str) = ''::str -rtrim(null::str) = null::str +rtrim('abc'::str, ' '::str) = 'abc'::str +rtrim(' abc'::str, ' '::str) = ' abc'::str +rtrim('abc '::str, ' '::str) = 'abc'::str +rtrim(' abc '::str, ' '::str) = ' abc'::str +rtrim(''::str, ' '::str) = ''::str +rtrim(' '::str, ' '::str) = ''::str +rtrim(null::str, ' '::str) = null::str # two_inputs: Examples with character input to trim off rtrim('aaaaabccccc'::str, 'c'::str) [spaces_only:FALSE] = 'aaaaab'::str diff --git a/tests/cases/string/starts_with.test b/tests/cases/string/starts_with.test index 212cec1eb..98ddc6910 100644 --- a/tests/cases/string/starts_with.test +++ b/tests/cases/string/starts_with.test @@ -4,6 +4,7 @@ # basic: Basic examples without any special cases starts_with('abcd'::str, 'a'::str) = true::bool starts_with('abcd'::str, 'z'::str) = false::bool +starts_with('abcd'::str, 'AB'::str) = false::bool # case_insenstivity: multi byte character comparison with case insensitivity starts_with('abcd'::str, 'AB'::str) [case_sensitivity:CASE_INSENSITIVE] = true::bool diff --git a/tests/cases/string/string_split.test b/tests/cases/string/string_split.test new file mode 100644 index 000000000..13726cf05 --- /dev/null +++ b/tests/cases/string/string_split.test @@ -0,0 +1,9 @@ +### SUBSTRAIT_SCALAR_TEST: v1.0 +### SUBSTRAIT_INCLUDE: '/extensions/functions_string.yaml' + +# basic: Basic examples without any special cases +string_split('abc'::str, ' '::str) = ['abc']::list +string_split('abc abc'::str, ' '::str) = ['abc', 'abc']::list +string_split('bacad'::str, 'a'::str) = ['b', 'c', 'd']::list +string_split('a b c d'::str, ' '::str) = ['a', 'b', 'c', 'd']::list +string_split('a b c d'::str, null::str) = ['a b c d']::list diff --git a/tests/cases/string/trim.test b/tests/cases/string/trim.test index 2e468e1aa..f93c3e291 100644 --- a/tests/cases/string/trim.test +++ b/tests/cases/string/trim.test @@ -2,13 +2,13 @@ ### SUBSTRAIT_INCLUDE: '/extensions/functions_string.yaml' # basic: Basic examples without any special cases -trim('abc'::str) = 'abc'::str -trim(' abc'::str) = 'abc'::str -trim('abc '::str) = 'abc'::str -trim(' abc '::str) = 'abc'::str -trim(''::str) = ''::str -trim(' '::str) = ''::str -trim(null::str) = null::str +trim('abc'::str, ' '::str) = 'abc'::str +trim(' abc'::str, ' '::str) = 'abc'::str +trim('abc '::str, ' '::str) = 'abc'::str +trim(' abc '::str, ' '::str) = 'abc'::str +trim(''::str, ' '::str) = ''::str +trim(' '::str, ' '::str) = ''::str +trim(null::str, ' '::str) = null::str # two_inputs: Examples with character input to trim off trim('aaaaabcccccaaa'::str, 'a'::str) [spaces_only:False] = 'bccccc'::str diff --git a/tests/coverage/case_file_parser.py b/tests/coverage/case_file_parser.py index 9632c4fcb..f79f94b4a 100644 --- a/tests/coverage/case_file_parser.py +++ b/tests/coverage/case_file_parser.py @@ -45,7 +45,7 @@ def parse_stream(input_stream, file_path): def parse_one_file(file_path): - return parse_stream(FileStream(file_path), file_path) + return parse_stream(FileStream(file_path, "UTF-8"), file_path) def parse_testcase_directory_recursively(dir_path): diff --git a/tests/test_extensions.py b/tests/test_extensions.py index 6a33cad61..e3120c7e9 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -24,15 +24,15 @@ def test_substrait_extension_coverage(): all_test_files = load_all_testcases(test_case_dir) coverage = get_test_coverage(all_test_files, registry) - assert coverage.test_count >= 49 + assert coverage.test_count >= 1018 assert ( coverage.num_tests_with_no_matching_function == 0 ), f"{coverage.num_tests_with_no_matching_function} tests with no matching function" - assert coverage.num_covered_function_variants >= 18 + assert coverage.num_covered_function_variants >= 223 assert coverage.total_function_variants >= 510 assert ( coverage.total_function_variants - coverage.num_covered_function_variants - ) <= 492, ( + ) <= 287, ( f"Coverage gap too large: {coverage.total_function_variants - coverage.num_covered_function_variants} " f"function variants with no tests, out of {coverage.total_function_variants} total function variants." )