@@ -23,8 +23,9 @@ CREATE TABLE test(
2323 hex_field TEXT
2424) as VALUES
2525 (0, 'abc', encode('abc', 'base64'), encode('abc', 'hex')),
26- (1, 'qweqwe', encode('qweqwe', 'base64'), encode('qweqwe', 'hex')),
27- (2, NULL, NULL, NULL)
26+ (1, 'qweqwe', encode('qweqwe', 'base64'), encode('qweqwe', 'hex')),
27+ (2, NULL, NULL, NULL),
28+ (3, X'8f50d3f60eae370ddbf85c86219c55108a350165', encode('8f50d3f60eae370ddbf85c86219c55108a350165', 'base64'), encode('8f50d3f60eae370ddbf85c86219c55108a350165', 'hex'))
2829;
2930
3031# errors
@@ -43,34 +44,51 @@ select decode(hex_field, 'non_encoding') from test;
4344query error
4445select to_hex(hex_field) from test;
4546
47+ query error
48+ select arrow_cast(decode(X'8f50d3f60eae370ddbf85c86219c55108a350165', 'base64'), 'Utf8');
49+
4650# Arrays tests
4751query T
4852SELECT encode(bin_field, 'hex') FROM test ORDER BY num;
4953----
5054616263
5155717765717765
5256NULL
57+ 8f50d3f60eae370ddbf85c86219c55108a350165
5358
5459query T
5560SELECT arrow_cast(decode(base64_field, 'base64'), 'Utf8') FROM test ORDER BY num;
5661----
5762abc
5863qweqwe
5964NULL
65+ 8f50d3f60eae370ddbf85c86219c55108a350165
6066
6167query T
6268SELECT arrow_cast(decode(hex_field, 'hex'), 'Utf8') FROM test ORDER BY num;
6369----
6470abc
6571qweqwe
6672NULL
73+ 8f50d3f60eae370ddbf85c86219c55108a350165
6774
6875query T
6976select to_hex(num) from test ORDER BY num;
7077----
71780
72791
73802
81+ 3
82+
83+ query T
84+ select encode(bin_field, 'base64') FROM test WHERE num = 3;
85+ ----
86+ j1DT9g6uNw3b+FyGIZxVEIo1AWU
87+
88+ query B
89+ select decode(encode(bin_field, 'base64'), 'base64') = X'8f50d3f60eae370ddbf85c86219c55108a350165' FROM test WHERE num = 3;
90+ ----
91+ true
7492
7593# test for Utf8View support for encode
7694statement ok
@@ -101,4 +119,4 @@ FROM test_utf8view;
101119Andrew QW5kcmV3 416e64726577 X WA 58
102120Xiangpeng WGlhbmdwZW5n 5869616e6770656e67 Xiangpeng WGlhbmdwZW5n 5869616e6770656e67
103121Raphael UmFwaGFlbA 5261706861656c R Ug 52
104- NULL NULL NULL R Ug 52
122+ NULL NULL NULL R Ug 52
0 commit comments