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


##########
c_glib/test/test-binary-view-array.rb:
##########
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestBinaryViewArray < Test::Unit::TestCase
+  def test_new
+    view_bytes = 16

Review Comment:
   I got the exception `Error: test_new(TestBinaryViewArray): 
Arrow::Error::Invalid: [array][validate-full]: Invalid: Buffer #1 too small in 
array of type binary_view and length 1: expected at least 16 byte(s), got 8` if 
I don't use padding.
   
   ```ruby
     def test_new
       # 
https://arrow.apache.org/docs/format/Columnar.html#variable-size-binary-view-layout
       short_binary_data = "test"
       short_view_buffer_space = 12
       short_view_buffer = [short_binary_data.size].pack("l")
       #short_view_buffer += short_binary_data.ljust(short_view_buffer_space, 
"\x00")
       short_view_buffer += short_binary_data
   
       arrow_view_buffer = Arrow::Buffer.new(short_view_buffer)
       arrow_data_buffer = Arrow::Buffer.new(short_binary_data)
       bitmap = Arrow::Buffer.new([0b1].pack("C*"))
   
       binary_view_array = Arrow::BinaryViewArray.new(1,
                                                      arrow_view_buffer,
                                                      [arrow_data_buffer],
                                                      bitmap,
                                                      0,
                                                      0)
       assert do
         binary_view_array.validate_full
       end
       assert_equal(short_binary_data, binary_view_array.get_value(0).to_s)
     end
   ```
   
   



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