Repository: apache/arrow
File: ruby/red-arrow-format/test/test-file-reader.rb (Ruby)

Code before:
      Arrow::TimestampArray.new(:second,
                                [
                                  @timestamp_2019_11_18_00_09_11,
                                  nil,
                                  @timestamp_2025_12_16_05_33_58,
                                ])
    end

    def test_read
      assert_equal([
                     {
                       "value" => [
                         @timestamp_2019_11_18_00_09_11,
                         nil,
                         @timestamp_2025_12_16_05_33_58,
                       ],
                     },
                   ],
                   read)
    end
  end

  sub_test_case("Timestamp(:nanosecond)") do
    def setup(&block)
      @timestamp_2019_11_18_00_09_11 = 1574003351 * 1_000_000_000
      @timestamp_2025_12_16_05_33_58 = 1765863238 * 1_000_000_000
      super(&block)
    end

    def build_array
      Arrow::TimestampArray.new(:second,
                                [
                                  @timestamp_2019_11_18_00_09_11,
                                  nil,
                                  @timestamp_2025_12_16_05_33_58,
                                ])
    end

    def test_read
      assert_equal([
                     {
                       "value" => [
                         @timestamp_2019_11_18_00_09_11,
                         nil,
                         @timestamp_2025_12_16_05_33_58,
                       ],
                     },
                   ],
                   read)
    end
  end

Review comment (suggestion):
```suggestion
      @timestamp_2025_12_16_05_33_58 = 1765830838 * 1_000_000_000
```

```
[6] pry(main)> Time.new(2025,12,16,5,33,58).to_i
=> 1765830838
```

Code after:
      Arrow::TimestampArray.new(:micro,
                                [
                                  @timestamp_2019_11_18_00_09_11,
                                  nil,
                                  @timestamp_2025_12_16_05_33_58,
                                ])
    end

    def test_read
      assert_equal([
                     {
                       "value" => [
                         @timestamp_2019_11_18_00_09_11,
                         nil,
                         @timestamp_2025_12_16_05_33_58,
                       ],
                     },
                   ],
                   read)
    end
  end

  sub_test_case("Timestamp(:nanosecond)") do
    def setup(&block)
      @timestamp_2019_11_18_00_09_11 = 1574003351 * 1_000_000_000
      @timestamp_2025_12_16_05_33_58 = 1765863238 * 1_000_000_000
      super(&block)
    end

    def build_array
      Arrow::TimestampArray.new(:nano,
                                [
                                  @timestamp_2019_11_18_00_09_11,
                                  nil,
                                  @timestamp_2025_12_16_05_33_58,
                                ])
    end

    def test_read
      assert_equal([
                     {
                       "value" => [
                         @timestamp_2019_11_18_00_09_11,
                         nil,
                         @timestamp_2025_12_16_05_33_58,
                       ],
                     },
                   ],
                   read)
    end
  end