You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Moelf (via GitHub)" <gi...@apache.org> on 2023/04/13 03:58:33 UTC

[GitHub] [arrow-julia] Moelf commented on a diff in pull request #419: fix `Vector{UInt8}` writing

Moelf commented on code in PR #419:
URL: https://github.com/apache/arrow-julia/pull/419#discussion_r1164964813


##########
src/eltypes.jl:
##########
@@ -393,23 +393,21 @@ end
 
 # arrowtype will call fieldoffset recursively for children
 function arrowtype(b, x::List{T, O, A}) where {T, O, A}
-    if eltype(A) == UInt8
-        if T <: AbstractString || T <: Union{AbstractString, Missing}
-            if O == Int32
-                Meta.utf8Start(b)
-                return Meta.Utf8, Meta.utf8End(b), nothing
-            else # if O == Int64
-                Meta.largUtf8Start(b)
-                return Meta.LargeUtf8, Meta.largUtf8End(b), nothing
-            end
-        else # if Vector{UInt8}
-            if O == Int32
-                Meta.binaryStart(b)
-                return Meta.Binary, Meta.binaryEnd(b), nothing
-            else # if O == Int64
-                Meta.largeBinaryStart(b)
-                return Meta.LargeBinary, Meta.largeBinaryEnd(b), nothing
-            end
+    if eltype(A) == UInt8 && T <: AbstractString || T <: Union{AbstractString, Missing}
+        if O == Int32
+            Meta.utf8Start(b)
+            return Meta.Utf8, Meta.utf8End(b), nothing
+        else # if O == Int64
+            Meta.largUtf8Start(b)
+            return Meta.LargeUtf8, Meta.largUtf8End(b), nothing
+        end
+    elseif eltype(A) == UInt8 && ArrowTypes.isstringtype(T)

Review Comment:
   the only additional type cathed here is `Base.CodeUnits`.
   
   Ideally, we want the first (above) used for long string and this one for short-string, but that's not a well defined concept, so for now we just say, "use CodeUnits if you want output byte-string in Arrow"



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org