mapleFU commented on code in PR #36972:
URL: https://github.com/apache/arrow/pull/36972#discussion_r1285158838


##########
cpp/src/parquet/encoding.cc:
##########
@@ -365,7 +369,7 @@ class PlainEncoder<BooleanType> : public EncoderImpl, 
virtual public BooleanEnco
       }
       writer.Finish();
     }
-    sink_.UnsafeAdvance(data.length());
+    sink_.UnsafeAdvance(data.length() - data.null_count());

Review Comment:
   Yes, the logic here is confusing, but it's right after my change. When input 
k boolean values.
   
   1. `sink_.Reserve` will only reserve bytes for bits (k).
   2. `sink_.UnsafeAdvance` will advance k bytes.
   
   However, when used, `sink_.length()` will only be regarded as bits. So (2) 
has a bug, but it works here...
   
   I'd like to fix the bug first, and take time to optimize the code later.



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

Reply via email to