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

[GitHub] [arrow-julia] baumgold commented on a diff in pull request #448: Fix case where compressed file reports non-zero buffer length

baumgold commented on code in PR #448:
URL: https://github.com/apache/arrow-julia/pull/448#discussion_r1215489558


##########
src/table.jl:
##########
@@ -570,10 +570,9 @@ function buildbitmap(batch, rb, nodeidx, bufferidx)
 end
 
 function uncompress(ptr::Ptr{UInt8}, buffer, compression)
-    if buffer.length == 0
-        return 0, UInt8[]
-    end
+    buffer.length == 0 && return 0, UInt8[]
     len = unsafe_load(convert(Ptr{Int64}, ptr))
+    len == 0 && return 0, UInt8[]

Review Comment:
   Maybe we should use iszero instead?
   
   ```suggestion
       iszero(len) && return 0, UInt8[]
   ```



##########
src/table.jl:
##########
@@ -570,10 +570,9 @@ function buildbitmap(batch, rb, nodeidx, bufferidx)
 end
 
 function uncompress(ptr::Ptr{UInt8}, buffer, compression)
-    if buffer.length == 0
-        return 0, UInt8[]
-    end
+    buffer.length == 0 && return 0, UInt8[]

Review Comment:
   maybe we should use iszero instead?
   
   ```suggestion
       iszero(buffer.length) && return 0, UInt8[]
   ```



-- 
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