You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/09 09:26:56 UTC

[GitHub] [arrow] okadakk opened a new pull request, #12850: ARROW-15935 [Ruby] Add test for Arrow::DictionaryArray#values

okadakk opened a new pull request, #12850:
URL: https://github.com/apache/arrow/pull/12850

   I added Arrow::DictionaryArray.values test


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] ursabot commented on pull request #12850: ARROW-15935: [Ruby] Add test for Arrow::DictionaryArray#values

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #12850:
URL: https://github.com/apache/arrow/pull/12850#issuecomment-1095973450

   Benchmark runs are scheduled for baseline = 71ba86425765478e5bc7a9db3eacf85bb8e21515 and contender = fe11431ab66572c4432cac76ff20d587f840f302. fe11431ab66572c4432cac76ff20d587f840f302 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/5bd9dcfa55b0477dbed2376a87660bb7...efec102c870847718b257db115fa8a81/)
   [Failed :arrow_down:0.13% :arrow_up:0.0%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/717a9db8c8c2429aabcc688c13983ed9...db2760516fcb49ae829f5cc4412da55e/)
   [Failed :arrow_down:0.36% :arrow_up:0.36%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/27dd584862374e099235dd84afddefcb...f05441fb3c454549998ecacd721fd6f8/)
   [Finished :arrow_down:0.04% :arrow_up:0.0%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/6c2274fd3d4043908ceb188365827bb9...f70928f535d147ef9f2c0568c85efc00/)
   Buildkite builds:
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/487| `fe11431a` ec2-t3-xlarge-us-east-2>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/472| `fe11431a` test-mac-arm>
   [Failed] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/473| `fe11431a` ursa-i9-9960x>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/482| `fe11431a` ursa-thinkcentre-m75q>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/486| `71ba8642` ec2-t3-xlarge-us-east-2>
   [Failed] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/471| `71ba8642` test-mac-arm>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/472| `71ba8642` ursa-i9-9960x>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/481| `71ba8642` ursa-thinkcentre-m75q>
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] kou closed pull request #12850: ARROW-15935: [Ruby] Add test for Arrow::DictionaryArray#values

Posted by GitBox <gi...@apache.org>.
kou closed pull request #12850: ARROW-15935: [Ruby] Add test for Arrow::DictionaryArray#values
URL: https://github.com/apache/arrow/pull/12850


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] github-actions[bot] commented on pull request #12850: ARROW-15935: [Ruby] Add test for Arrow::DictionaryArray#values

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12850:
URL: https://github.com/apache/arrow/pull/12850#issuecomment-1093837000

   :warning: Ticket **has no components in JIRA**, make sure you assign one.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] kou commented on a diff in pull request #12850: ARROW-15935: [Ruby] Add test for Arrow::DictionaryArray#values

Posted by GitBox <gi...@apache.org>.
kou commented on code in PR #12850:
URL: https://github.com/apache/arrow/pull/12850#discussion_r846865234


##########
ruby/red-arrow/test/values/test-dictionary-array.rb:
##########
@@ -0,0 +1,295 @@
+# 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.
+
+module ValuesDictionaryArrayTests
+  def test_null
+    target = build(Arrow::NullArray.new(4))
+    assert_equal([nil] * 4, target.values)
+  end
+
+  def test_boolean
+    values = [true, nil, false]
+    target = build(Arrow::BooleanArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int8
+    values = [
+      -(2 ** 7),
+      nil,
+      (2 ** 7) - 1,
+    ]
+    target = build(Arrow::Int8Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint8
+    values = [
+      0,
+      nil,
+      (2 ** 8) - 1,
+    ]
+    target = build(Arrow::UInt8Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int16
+    values = [
+      -(2 ** 15),
+      nil,
+      (2 ** 15) - 1,
+    ]
+    target = build(Arrow::Int16Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint16
+    values = [
+      0,
+      nil,
+      (2 ** 16) - 1,
+    ]
+    target = build(Arrow::UInt16Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int32
+    values = [
+      -(2 ** 31),
+      nil,
+      (2 ** 31) - 1,
+    ]
+    target = build(Arrow::Int32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint32
+    values = [
+      0,
+      nil,
+      (2 ** 32) - 1,
+    ]
+    target = build(Arrow::UInt32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int64
+    values = [
+      -(2 ** 63),
+      nil,
+      (2 ** 63) - 1,
+    ]
+    target = build(Arrow::Int64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint64
+    values = [
+      0,
+      nil,
+      (2 ** 64) - 1,
+    ]
+    target = build(Arrow::UInt64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_float
+    values = [
+      -1.0,
+      nil,
+      1.0,
+    ]
+    target = build(Arrow::FloatArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_double
+    values = [
+      -1.0,
+      nil,
+      1.0,
+    ]
+    target = build(Arrow::DoubleArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_binary
+    values = [
+      "\x00".b,
+      nil,
+      "\xff".b,
+    ]
+    target = build(Arrow::BinaryArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_tring

Review Comment:
   ```suggestion
     def test_string
   ```



##########
ruby/red-arrow/test/values/test-dictionary-array.rb:
##########
@@ -0,0 +1,295 @@
+# 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.
+
+module ValuesDictionaryArrayTests
+  def test_null
+    target = build(Arrow::NullArray.new(4))
+    assert_equal([nil] * 4, target.values)
+  end
+
+  def test_boolean
+    values = [true, nil, false]
+    target = build(Arrow::BooleanArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int8
+    values = [
+      -(2 ** 7),
+      nil,
+      (2 ** 7) - 1,
+    ]
+    target = build(Arrow::Int8Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint8
+    values = [
+      0,
+      nil,
+      (2 ** 8) - 1,
+    ]
+    target = build(Arrow::UInt8Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int16
+    values = [
+      -(2 ** 15),
+      nil,
+      (2 ** 15) - 1,
+    ]
+    target = build(Arrow::Int16Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint16
+    values = [
+      0,
+      nil,
+      (2 ** 16) - 1,
+    ]
+    target = build(Arrow::UInt16Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int32
+    values = [
+      -(2 ** 31),
+      nil,
+      (2 ** 31) - 1,
+    ]
+    target = build(Arrow::Int32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint32
+    values = [
+      0,
+      nil,
+      (2 ** 32) - 1,
+    ]
+    target = build(Arrow::UInt32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int64
+    values = [
+      -(2 ** 63),
+      nil,
+      (2 ** 63) - 1,
+    ]
+    target = build(Arrow::Int64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint64
+    values = [
+      0,
+      nil,
+      (2 ** 64) - 1,
+    ]
+    target = build(Arrow::UInt64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_float
+    values = [
+      -1.0,
+      nil,
+      1.0,
+    ]
+    target = build(Arrow::FloatArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_double
+    values = [
+      -1.0,
+      nil,
+      1.0,
+    ]
+    target = build(Arrow::DoubleArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_binary
+    values = [
+      "\x00".b,
+      nil,
+      "\xff".b,
+    ]
+    target = build(Arrow::BinaryArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_tring
+    values = [
+      "Ruby",
+      nil,
+      "\u3042", # U+3042 HIRAGANA LETTER A
+    ]
+    target = build(Arrow::StringArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_date32
+    values = [
+      Date.new(1960, 1, 1),
+      nil,
+      Date.new(2017, 8, 23),
+    ]
+    target = build(Arrow::Date32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_date64
+    values = [
+      DateTime.new(1960, 1, 1, 2, 9, 30),
+      nil,
+      DateTime.new(2017, 8, 23, 14, 57, 2),
+    ]
+    target = build(Arrow::Date64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_second
+    values = [
+      Time.parse("1960-01-01T02:09:30Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:second, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_milli
+    values = [
+      Time.parse("1960-01-01T02:09:30.123Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:milli, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_micro
+    values = [
+      Time.parse("1960-01-01T02:09:30.123456Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987654Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:micro, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_nano
+    values = [
+      Time.parse("1960-01-01T02:09:30.123456789Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987654321Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:nano, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_time32_second
+    unit = Arrow::TimeUnit::SECOND
+    values = [
+      Arrow::Time.new(unit, 60 * 10), # 00:10:00
+      nil,
+      Arrow::Time.new(unit, 60 * 60 * 2 + 9), # 02:00:09
+    ]
+    target = build(Arrow::Time32Array.new(:second, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_time32_milli
+    unit = Arrow::TimeUnit::MILLI
+    values = [
+      Arrow::Time.new(unit, (60 * 10) * 1000 + 123), # 00:10:00.123
+      nil,
+      Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1000 + 987), # 02:00:09.987
+    ]
+    target = build(Arrow::Time32Array.new(:milli, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_time64_micro
+    unit = Arrow::TimeUnit::MICRO
+    values = [
+      # 00:10:00.123456
+      Arrow::Time.new(unit, (60 * 10) * 1_000_000 + 123_456),
+      nil,
+      # 02:00:09.987654
+      Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1_000_000 + 987_654),
+    ]
+    target = build(Arrow::Time64Array.new(:micro, values))

Review Comment:
   ```suggestion
       target = build(Arrow::Time64Array.new(unit, values))
   ```



##########
ruby/red-arrow/test/values/test-dictionary-array.rb:
##########
@@ -0,0 +1,295 @@
+# 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.
+
+module ValuesDictionaryArrayTests
+  def test_null
+    target = build(Arrow::NullArray.new(4))
+    assert_equal([nil] * 4, target.values)
+  end
+
+  def test_boolean
+    values = [true, nil, false]
+    target = build(Arrow::BooleanArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int8
+    values = [
+      -(2 ** 7),
+      nil,
+      (2 ** 7) - 1,
+    ]
+    target = build(Arrow::Int8Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint8
+    values = [
+      0,
+      nil,
+      (2 ** 8) - 1,
+    ]
+    target = build(Arrow::UInt8Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int16
+    values = [
+      -(2 ** 15),
+      nil,
+      (2 ** 15) - 1,
+    ]
+    target = build(Arrow::Int16Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint16
+    values = [
+      0,
+      nil,
+      (2 ** 16) - 1,
+    ]
+    target = build(Arrow::UInt16Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int32
+    values = [
+      -(2 ** 31),
+      nil,
+      (2 ** 31) - 1,
+    ]
+    target = build(Arrow::Int32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint32
+    values = [
+      0,
+      nil,
+      (2 ** 32) - 1,
+    ]
+    target = build(Arrow::UInt32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int64
+    values = [
+      -(2 ** 63),
+      nil,
+      (2 ** 63) - 1,
+    ]
+    target = build(Arrow::Int64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint64
+    values = [
+      0,
+      nil,
+      (2 ** 64) - 1,
+    ]
+    target = build(Arrow::UInt64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_float
+    values = [
+      -1.0,
+      nil,
+      1.0,
+    ]
+    target = build(Arrow::FloatArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_double
+    values = [
+      -1.0,
+      nil,
+      1.0,
+    ]
+    target = build(Arrow::DoubleArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_binary
+    values = [
+      "\x00".b,
+      nil,
+      "\xff".b,
+    ]
+    target = build(Arrow::BinaryArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_tring
+    values = [
+      "Ruby",
+      nil,
+      "\u3042", # U+3042 HIRAGANA LETTER A
+    ]
+    target = build(Arrow::StringArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_date32
+    values = [
+      Date.new(1960, 1, 1),
+      nil,
+      Date.new(2017, 8, 23),
+    ]
+    target = build(Arrow::Date32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_date64
+    values = [
+      DateTime.new(1960, 1, 1, 2, 9, 30),
+      nil,
+      DateTime.new(2017, 8, 23, 14, 57, 2),
+    ]
+    target = build(Arrow::Date64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_second
+    values = [
+      Time.parse("1960-01-01T02:09:30Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:second, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_milli
+    values = [
+      Time.parse("1960-01-01T02:09:30.123Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:milli, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_micro
+    values = [
+      Time.parse("1960-01-01T02:09:30.123456Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987654Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:micro, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_nano
+    values = [
+      Time.parse("1960-01-01T02:09:30.123456789Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987654321Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:nano, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_time32_second
+    unit = Arrow::TimeUnit::SECOND
+    values = [
+      Arrow::Time.new(unit, 60 * 10), # 00:10:00
+      nil,
+      Arrow::Time.new(unit, 60 * 60 * 2 + 9), # 02:00:09
+    ]
+    target = build(Arrow::Time32Array.new(:second, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_time32_milli
+    unit = Arrow::TimeUnit::MILLI
+    values = [
+      Arrow::Time.new(unit, (60 * 10) * 1000 + 123), # 00:10:00.123
+      nil,
+      Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1000 + 987), # 02:00:09.987
+    ]
+    target = build(Arrow::Time32Array.new(:milli, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_time64_micro
+    unit = Arrow::TimeUnit::MICRO
+    values = [
+      # 00:10:00.123456
+      Arrow::Time.new(unit, (60 * 10) * 1_000_000 + 123_456),
+      nil,
+      # 02:00:09.987654
+      Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1_000_000 + 987_654),
+    ]
+    target = build(Arrow::Time64Array.new(:micro, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_time64_nano
+    unit = Arrow::TimeUnit::NANO
+    values = [
+      # 00:10:00.123456789
+      Arrow::Time.new(unit, (60 * 10) * 1_000_000_000 + 123_456_789),
+      nil,
+      # 02:00:09.987654321
+      Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1_000_000_000 + 987_654_321),
+    ]
+    target = build(Arrow::Time64Array.new(:nano, values))

Review Comment:
   ```suggestion
       target = build(Arrow::Time64Array.new(unit, values))
   ```



##########
ruby/red-arrow/test/values/test-dictionary-array.rb:
##########
@@ -0,0 +1,295 @@
+# 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.
+
+module ValuesDictionaryArrayTests
+  def test_null
+    target = build(Arrow::NullArray.new(4))
+    assert_equal([nil] * 4, target.values)
+  end
+
+  def test_boolean
+    values = [true, nil, false]
+    target = build(Arrow::BooleanArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int8
+    values = [
+      -(2 ** 7),
+      nil,
+      (2 ** 7) - 1,
+    ]
+    target = build(Arrow::Int8Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint8
+    values = [
+      0,
+      nil,
+      (2 ** 8) - 1,
+    ]
+    target = build(Arrow::UInt8Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int16
+    values = [
+      -(2 ** 15),
+      nil,
+      (2 ** 15) - 1,
+    ]
+    target = build(Arrow::Int16Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint16
+    values = [
+      0,
+      nil,
+      (2 ** 16) - 1,
+    ]
+    target = build(Arrow::UInt16Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int32
+    values = [
+      -(2 ** 31),
+      nil,
+      (2 ** 31) - 1,
+    ]
+    target = build(Arrow::Int32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint32
+    values = [
+      0,
+      nil,
+      (2 ** 32) - 1,
+    ]
+    target = build(Arrow::UInt32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int64
+    values = [
+      -(2 ** 63),
+      nil,
+      (2 ** 63) - 1,
+    ]
+    target = build(Arrow::Int64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint64
+    values = [
+      0,
+      nil,
+      (2 ** 64) - 1,
+    ]
+    target = build(Arrow::UInt64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_float
+    values = [
+      -1.0,
+      nil,
+      1.0,
+    ]
+    target = build(Arrow::FloatArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_double
+    values = [
+      -1.0,
+      nil,
+      1.0,
+    ]
+    target = build(Arrow::DoubleArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_binary
+    values = [
+      "\x00".b,
+      nil,
+      "\xff".b,
+    ]
+    target = build(Arrow::BinaryArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_tring
+    values = [
+      "Ruby",
+      nil,
+      "\u3042", # U+3042 HIRAGANA LETTER A
+    ]
+    target = build(Arrow::StringArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_date32
+    values = [
+      Date.new(1960, 1, 1),
+      nil,
+      Date.new(2017, 8, 23),
+    ]
+    target = build(Arrow::Date32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_date64
+    values = [
+      DateTime.new(1960, 1, 1, 2, 9, 30),
+      nil,
+      DateTime.new(2017, 8, 23, 14, 57, 2),
+    ]
+    target = build(Arrow::Date64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_second
+    values = [
+      Time.parse("1960-01-01T02:09:30Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:second, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_milli
+    values = [
+      Time.parse("1960-01-01T02:09:30.123Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:milli, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_micro
+    values = [
+      Time.parse("1960-01-01T02:09:30.123456Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987654Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:micro, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_nano
+    values = [
+      Time.parse("1960-01-01T02:09:30.123456789Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987654321Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:nano, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_time32_second
+    unit = Arrow::TimeUnit::SECOND
+    values = [
+      Arrow::Time.new(unit, 60 * 10), # 00:10:00
+      nil,
+      Arrow::Time.new(unit, 60 * 60 * 2 + 9), # 02:00:09
+    ]
+    target = build(Arrow::Time32Array.new(:second, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_time32_milli
+    unit = Arrow::TimeUnit::MILLI
+    values = [
+      Arrow::Time.new(unit, (60 * 10) * 1000 + 123), # 00:10:00.123
+      nil,
+      Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1000 + 987), # 02:00:09.987
+    ]
+    target = build(Arrow::Time32Array.new(:milli, values))

Review Comment:
   ```suggestion
       target = build(Arrow::Time32Array.new(unit, values))
   ```



##########
ruby/red-arrow/test/values/test-dictionary-array.rb:
##########
@@ -0,0 +1,295 @@
+# 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.
+
+module ValuesDictionaryArrayTests
+  def test_null
+    target = build(Arrow::NullArray.new(4))
+    assert_equal([nil] * 4, target.values)
+  end
+
+  def test_boolean
+    values = [true, nil, false]
+    target = build(Arrow::BooleanArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int8
+    values = [
+      -(2 ** 7),
+      nil,
+      (2 ** 7) - 1,
+    ]
+    target = build(Arrow::Int8Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint8
+    values = [
+      0,
+      nil,
+      (2 ** 8) - 1,
+    ]
+    target = build(Arrow::UInt8Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int16
+    values = [
+      -(2 ** 15),
+      nil,
+      (2 ** 15) - 1,
+    ]
+    target = build(Arrow::Int16Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint16
+    values = [
+      0,
+      nil,
+      (2 ** 16) - 1,
+    ]
+    target = build(Arrow::UInt16Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int32
+    values = [
+      -(2 ** 31),
+      nil,
+      (2 ** 31) - 1,
+    ]
+    target = build(Arrow::Int32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint32
+    values = [
+      0,
+      nil,
+      (2 ** 32) - 1,
+    ]
+    target = build(Arrow::UInt32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_int64
+    values = [
+      -(2 ** 63),
+      nil,
+      (2 ** 63) - 1,
+    ]
+    target = build(Arrow::Int64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_uint64
+    values = [
+      0,
+      nil,
+      (2 ** 64) - 1,
+    ]
+    target = build(Arrow::UInt64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_float
+    values = [
+      -1.0,
+      nil,
+      1.0,
+    ]
+    target = build(Arrow::FloatArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_double
+    values = [
+      -1.0,
+      nil,
+      1.0,
+    ]
+    target = build(Arrow::DoubleArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_binary
+    values = [
+      "\x00".b,
+      nil,
+      "\xff".b,
+    ]
+    target = build(Arrow::BinaryArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_tring
+    values = [
+      "Ruby",
+      nil,
+      "\u3042", # U+3042 HIRAGANA LETTER A
+    ]
+    target = build(Arrow::StringArray.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_date32
+    values = [
+      Date.new(1960, 1, 1),
+      nil,
+      Date.new(2017, 8, 23),
+    ]
+    target = build(Arrow::Date32Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_date64
+    values = [
+      DateTime.new(1960, 1, 1, 2, 9, 30),
+      nil,
+      DateTime.new(2017, 8, 23, 14, 57, 2),
+    ]
+    target = build(Arrow::Date64Array.new(values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_second
+    values = [
+      Time.parse("1960-01-01T02:09:30Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:second, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_milli
+    values = [
+      Time.parse("1960-01-01T02:09:30.123Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:milli, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_micro
+    values = [
+      Time.parse("1960-01-01T02:09:30.123456Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987654Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:micro, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_timestamp_nano
+    values = [
+      Time.parse("1960-01-01T02:09:30.123456789Z"),
+      nil,
+      Time.parse("2017-08-23T14:57:02.987654321Z"),
+    ]
+    target = build(Arrow::TimestampArray.new(:nano, values))
+    assert_equal(values, target.values)
+  end
+
+  def test_time32_second
+    unit = Arrow::TimeUnit::SECOND
+    values = [
+      Arrow::Time.new(unit, 60 * 10), # 00:10:00
+      nil,
+      Arrow::Time.new(unit, 60 * 60 * 2 + 9), # 02:00:09
+    ]
+    target = build(Arrow::Time32Array.new(:second, values))

Review Comment:
   ```suggestion
       target = build(Arrow::Time32Array.new(unit, values))
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] okadakk commented on pull request #12850: ARROW-15935: [Ruby] Add test for Arrow::DictionaryArray#values

Posted by GitBox <gi...@apache.org>.
okadakk commented on PR #12850:
URL: https://github.com/apache/arrow/pull/12850#issuecomment-1094991334

   Thank you! 
   I commited suggestions!


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] github-actions[bot] commented on pull request #12850: ARROW-15935: [Ruby] Add test for Arrow::DictionaryArray#values

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12850:
URL: https://github.com/apache/arrow/pull/12850#issuecomment-1093837005

   :warning: Ticket **has not been started in JIRA**, please click 'Start Progress'.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] github-actions[bot] commented on pull request #12850: ARROW-15935 [Ruby] Add test for Arrow::DictionaryArray#values

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12850:
URL: https://github.com/apache/arrow/pull/12850#issuecomment-1093836994

   https://issues.apache.org/jira/browse/ARROW-15935


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org