eddietejeda commented on code in PR #24867:
URL: https://github.com/apache/datafusion/pull/24867#discussion_r3916975565


##########
datafusion/sqllogictest/test_files/functions.slt:
##########
@@ -918,6 +918,48 @@ ORDER BY id
 2 2 Dictionary(Int32, Int32) Dictionary(Int32, Dictionary(UInt32, Int32))
 NULL NULL Dictionary(Int32, Int32) Dictionary(Int32, Dictionary(UInt32, Int32))
 
+# octet_length over binary types: byte semantics, no string coercion
+query I
+SELECT octet_length(arrow_cast('foo', 'Binary'))
+----
+3
+
+query IT
+SELECT octet_length(arrow_cast('josé', 'Binary')),
+       arrow_typeof(octet_length(arrow_cast('josé', 'Binary')))
+----
+5 Int32
+
+query IT
+SELECT octet_length(arrow_cast('foo', 'BinaryView')),
+       arrow_typeof(octet_length(arrow_cast('foo', 'BinaryView')))
+----
+3 Int32
+
+# LargeBinary widens the return type to Int64, mirroring LargeUtf8
+query IT
+SELECT octet_length(arrow_cast('foo', 'LargeBinary')),
+       arrow_typeof(octet_length(arrow_cast('foo', 'LargeBinary')))
+----
+3 Int64
+
+query I
+SELECT octet_length(arrow_cast(NULL, 'Binary'))
+----
+NULL
+
+# Dictionary encoding is preserved over binary values too
+query ?T
+SELECT octet_length(arrow_cast(arrow_cast('foo', 'Binary'), 'Dictionary(Int32, 
Binary)')),
+       arrow_typeof(octet_length(arrow_cast(arrow_cast('foo', 'Binary'), 
'Dictionary(Int32, Binary)')))
+----
+3 Dictionary(Int32, Int32)
+
+# FixedSizeBinary is a distinct logical type and is deliberately not accepted,

Review Comment:
   Fair point. I was trying to stay close to the other logical_binary 
signatures, but I'll expand support to FixedSizeBinary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to