Reranko05 commented on code in PR #50452:
URL: https://github.com/apache/arrow/pull/50452#discussion_r3556143546


##########
ruby/red-arrow-format/lib/arrow-format/array.rb:
##########
@@ -577,6 +587,55 @@ def to_a
     end
 
     private
+    def build_data(data)
+      type = self.class.type
+
+      n = 0
+      validity_buffer_builder = nil
+
+      values = +"".b
+      offsets = [0]
+
+      data.each_with_index do |value, i|
+        if value.nil?
+          validity_buffer_builder ||= SparseBitmapBuilder.new
+          validity_buffer_builder.unset(i)
+
+          offsets << values.bytesize
+        else
+          value = value.b if type.encoding == Encoding::ASCII_8BIT
+          value = value.encode(type.encoding)
+

Review Comment:
   Addressed.



##########
ruby/red-arrow-format/lib/arrow-format/array.rb:
##########
@@ -577,6 +587,55 @@ def to_a
     end
 
     private
+    def build_data(data)
+      type = self.class.type
+
+      n = 0
+      validity_buffer_builder = nil
+
+      values = +"".b
+      offsets = [0]
+
+      data.each_with_index do |value, i|
+        if value.nil?
+          validity_buffer_builder ||= SparseBitmapBuilder.new
+          validity_buffer_builder.unset(i)
+
+          offsets << values.bytesize
+        else
+          value = value.b if type.encoding == Encoding::ASCII_8BIT
+          value = value.encode(type.encoding)
+
+          values.append_as_bytes(value)
+          offsets << values.bytesize
+        end
+
+        n += 1
+      end
+
+      validity_buffer = validity_buffer_builder&.finish(n)
+
+      size = IO::Buffer.size_of(type.offset_buffer_type)

Review Comment:
   Addressed.



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