kou commented on code in PR #45650:
URL: https://github.com/apache/arrow/pull/45650#discussion_r1976819346


##########
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
+    buffer_string = "test"
+    view_data = [ buffer_string.size ].pack("l")

Review Comment:
   ```suggestion
       view_data = [buffer_string.size].pack("l")
   ```



##########
c_glib/arrow-glib/basic-array.cpp:
##########
@@ -127,6 +127,11 @@ G_BEGIN_DECLS
  * string data. If you don't have Arrow format data, you need to
  * use #GArrowLargeStringArrayBuilder to create a new array.
  *
+ * #GArrayBinaryViewArray is a class for variable-size binary view array

Review Comment:
   ```suggestion
    * #GArrayBinaryViewArray is a class for variable-size binary view array.
   ```



##########
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:
   Can we improve variable name something like the following?
   
   ```suggestion
       short_string_space = 12
   ```
   
   (I think that we don't need to include length space here.)
   
   FYI: The specification: 
https://arrow.apache.org/docs/format/Columnar.html#variable-size-binary-view-layout



##########
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
+    buffer_string = "test"

Review Comment:
   Can we improve variable name something like the following?
   
   ```suggestion
       short_binary_data = "test"
   ```



##########
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
+    buffer_string = "test"
+    view_data = [ buffer_string.size ].pack("l")
+    view_data += buffer_string
+    view_data += "\x00" * (view_bytes - buffer_string.size)

Review Comment:
   We can use `String#ljust` here:
   
   ```suggestion
       view_data += buffer_string.ljust(12, "\x00")
   ```



##########
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
+    buffer_string = "test"
+    view_data = [ buffer_string.size ].pack("l")
+    view_data += buffer_string
+    view_data += "\x00" * (view_bytes - buffer_string.size)
+
+    view = Arrow::Buffer.new(view_data)
+    data_buffer = Arrow::Buffer.new(buffer_string)
+    bitmap = Arrow::Buffer.new([0b1].pack("C*"))
+
+    str_view = Arrow::BinaryViewArray.new(1,view,[data_buffer],bitmap,0, 0)

Review Comment:
   ```suggestion
       binary_view = Arrow::BinaryViewArray.new(1, view, [data_buffer], bitmap, 
0, 0)
   ```



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