hiroyuki-sato commented on code in PR #48538:
URL: https://github.com/apache/arrow/pull/48538#discussion_r2618613889


##########
ruby/red-arrow-format/lib/arrow-format/file-reader.rb:
##########
@@ -256,6 +258,16 @@ def read_column(field, nodes, buffers, body)
         values_buffer = buffers.shift
         values = body.slice(values_buffer.offset, values_buffer.length)
         field.type.build_array(length, validity, values)
+      when VariableSizeBinaryType

Review Comment:
   Just for interest. What sort order are you use? Why you moved 
`VariableSizeBinaryType` here?
   (I asked for furture implementatation)



##########
ruby/red-arrow-format/lib/arrow-format/array.rb:
##########
@@ -229,6 +229,32 @@ def encoding
     end
   end
 
+  class FixedSizeBinaryArray < Array
+    def initialize(type, size, validity_buffer, values_buffer)
+      super(type, size, validity_buffer)
+      @values_buffer = values_buffer
+    end
+
+    def to_a
+      byte_width = @type.byte_width
+      values = 0.step(@size * byte_width - 1, byte_width).collect do |offset|
+        @values_buffer.get_string(offset, byte_width)
+      end
+      apply_validity(values)
+    end
+  end
+
+  class BinaryArray < VariableSizeBinaryLayoutArray
+    private
+    def buffer_type
+      :s32 # TODO: big endian support
+    end
+
+    def encoding
+      Encoding::ASCII_8BIT
+    end
+  end
+

Review Comment:
   ```suggestion
   ```
   
   ```
   /path/to/arrow/ruby/red-arrow-format/lib/arrow-format/array.rb:249: warning: 
method redefined; discarding old buffer_type
   /path/to/arrow/ruby/red-arrow-format/lib/arrow-format/array.rb:201: warning: 
previous definition of buffer_type was here
   /path/to/arrow/ruby/red-arrow-format/lib/arrow-format/array.rb:253: warning: 
method redefined; discarding old encoding
   /path/to/arrow/ruby/red-arrow-format/lib/arrow-format/array.rb:205: warning: 
previous definition of encoding was here
   ```



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