llama90 commented on code in PR #38147:
URL: https://github.com/apache/arrow/pull/38147#discussion_r1352878832


##########
cpp/src/arrow/compute/light_array.cc:
##########
@@ -80,16 +80,15 @@ KeyColumnArray KeyColumnArray::Slice(int64_t offset, 
int64_t length) const {
   KeyColumnArray sliced;
   sliced.metadata_ = metadata_;
   sliced.length_ = length;
-  uint32_t fixed_size =
-      !metadata_.is_fixed_length ? sizeof(uint32_t) : metadata_.fixed_length;
+  uint32_t fixed_size = metadata_.fixed_length;
 
   sliced.buffers_[0] =
       buffers_[0] ? buffers_[0] + (bit_offset_[0] + offset) / 8 : nullptr;
   sliced.mutable_buffers_[0] =
       mutable_buffers_[0] ? mutable_buffers_[0] + (bit_offset_[0] + offset) / 
8 : nullptr;
   sliced.bit_offset_[0] = (bit_offset_[0] + offset) % 8;
 
-  if (fixed_size == 0 && !metadata_.is_null_type) {
+  if (metadata_.fixed_length == 0 && !metadata_.is_null_type) {
     sliced.buffers_[1] =
         buffers_[1] ? buffers_[1] + (bit_offset_[1] + offset) / 8 : nullptr;

Review Comment:
   The code I modified is handled in the section below (`else` statement), 
reflecting the type size as `fixed_size`. 
   
   Upon reviewing the implementation of the `ColumnMetadataFromDataType` 
function, it is understood that the type applicable to the mentioned case is 
`BOOL` and `is_fixed_width()`. (In the case of `DICTIONARY`, it ensures that 
ARROW_DCHECK(bit_width % 8 == 0) is checked to guarantee that it is a multiple 
of 8.)
   
   
https://github.com/apache/arrow/blob/907723663e6e20033d0c2fef4eb0f880daacdb09/cpp/src/arrow/compute/light_array.cc#L111-L145
   
   * [Data Types](https://arrow.apache.org/docs/cpp/api/datatype.html)
   



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