Skip to content

Commit 31eb7ea

Browse files
committed
strlen -> octet_length
1 parent 566845b commit 31eb7ea

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/from_substrait.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const std::unordered_map<std::string, std::string> SubstraitToDuckDB::function_n
3131
{"ends_with", "suffix"}, {"substring", "substr"}, {"char_length", "length"},
3232
{"is_nan", "isnan"}, {"is_finite", "isfinite"}, {"is_infinite", "isinf"},
3333
{"like", "~~"}, {"extract", "date_part"}, {"bitwise_and", "&"},
34-
{"bitwise_or", "|"}, {"bitwise_xor", "xor"}};
34+
{"bitwise_or", "|"}, {"bitwise_xor", "xor"}, {"octet_length", "strlen"}};
3535

3636
const case_insensitive_set_t SubstraitToDuckDB::valid_extract_subfields = {
3737
"year", "month", "day", "decade", "century", "millenium",

src/to_substrait.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ const std::unordered_map<std::string, std::string> DuckDBToSubstrait::function_n
4141
{"!~~", "not_equal"},
4242
{"&", "bitwise_and"},
4343
{"|", "bitwise_or"},
44-
{"xor", "bitwise_xor"}};
44+
{"xor", "bitwise_xor"},
45+
{"strlen", "octet_length"}};
4546

4647
const case_insensitive_set_t DuckDBToSubstrait::valid_extract_subfields = {
4748
"year", "month", "day", "decade", "century", "millenium",

test/sql/test_functions.test

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ create table t as select 1 as a ,2 as b;
1212

1313
# bitwise_and
1414
statement ok
15-
CALL get_substrait('select a & b from t')
15+
CALL get_substrait('select a & b from t', strict = true)
1616

1717
# bitwise_or
1818
statement ok
19-
CALL get_substrait('select a | b from t')
19+
CALL get_substrait('select a | b from t', strict = true)
2020

2121
# bitwise_xor
2222
statement ok
23-
CALL get_substrait('select xor(a,b) from t')
23+
CALL get_substrait('select xor(a,b) from t', strict = true)
2424

25-
# octet_length
26-
#statement ok
27-
#CALL get_substrait('select octet_length(''100001'') from t')
25+
# strlen gets transformed to octet_length
26+
statement ok
27+
CALL get_substrait('select strlen(a::varchar) from t', strict = true)
2828

2929
# coalesce
3030
statement ok
31-
CALL get_substrait('select coalesce(a) from t')
31+
CALL get_substrait('select coalesce(a) from t', strict = true)
3232

3333
# acosh
3434
# asinh
@@ -37,4 +37,4 @@ CALL get_substrait('select coalesce(a) from t')
3737
# sinh
3838
# tanh
3939
statement ok
40-
CALL get_substrait('select acosh(a),asinh(a),atanh(a),cosh(a),sinh(a),tanh(a) from t')
40+
CALL get_substrait('select acosh(a),asinh(a),atanh(a),cosh(a),sinh(a),tanh(a) from t', strict = true)

0 commit comments

Comments
 (0)