Skip to content

Conversation

@kou
Copy link
Member

@kou kou commented Dec 16, 2025

Rationale for this change

It's an array for timestamp.

What changes are included in this PR?

  • Add ArrowFormat::TimestampType
  • Add ArrowFormat::TimestampArray

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes.

@github-actions
Copy link

⚠️ GitHub issue #48553 has been automatically assigned in GitHub to PR creator.

attr_reader :unit
attr_reader :timezone
def initialize(unit, timezone)
super("Temporal")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? super("Timestamp")?

sub_test_case("Timestamp(:second)") do
def setup(&block)
@timestamp_2019_11_18_00_09_11 = 1574003351
@timestamp_2025_12_16_05_33_58 = 1765863238
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@timestamp_2025_12_16_05_33_58 = 1765863238
@timestamp_2025_12_16_05_33_58 = 1765830838
[6] pry(main)> Time.new(2025,12,16,5,33,58).to_i
=> 1765830838

sub_test_case("Timestamp(:millisecond)") do
def setup(&block)
@timestamp_2019_11_18_00_09_11 = 1574003351 * 1_000
@timestamp_2025_12_16_05_33_58 = 1765863238 * 1_000
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@timestamp_2025_12_16_05_33_58 = 1765863238 * 1_000
@timestamp_2025_12_16_05_33_58 = 1765830838 * 1_000
[6] pry(main)> Time.new(2025,12,16,5,33,58).to_i
=> 1765830838

sub_test_case("Timestamp(:microsecond)") do
def setup(&block)
@timestamp_2019_11_18_00_09_11 = 1574003351 * 1_000_000
@timestamp_2025_12_16_05_33_58 = 1765863238 * 1_000_000
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@timestamp_2025_12_16_05_33_58 = 1765863238 * 1_000_000
@timestamp_2025_12_16_05_33_58 = 1765830838 * 1_000_000
[6] pry(main)> Time.new(2025,12,16,5,33,58).to_i
=> 1765830838

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@timestamp_2025_12_16_05_33_58 = 1765863238 * 1_000_000_000
@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

def setup(&block)
@timezone = "UTC"
@timestamp_2019_11_18_00_09_11 = 1574003351
@timestamp_2025_12_16_05_33_58 = 1765863238
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@timestamp_2025_12_16_05_33_58 = 1765863238
@timestamp_2025_12_16_05_33_58 = 1765830838
[6] pry(main)> Time.new(2025,12,16,5,33,58).to_i
=> 1765830838

end

def build_array
Arrow::TimestampArray.new(:second,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Arrow::TimestampArray.new(:second,
Arrow::TimestampArray.new(:micro,

end

def build_array
Arrow::TimestampArray.new(:second,
Copy link
Collaborator

@hiroyuki-sato hiroyuki-sato Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Arrow::TimestampArray.new(:second,
Arrow::TimestampArray.new(:milli,

Arrow::TimestampArray.new(:second returns value out of range

[8] pry(main)>       @timestamp_2019_11_18_00_09_11 = 1574003351 * 1_000
[8] pry(main)>       @timestamp_2025_12_16_05_33_58 = 1765863238 * 1_000
=> 1765863238000
[9] pry(main)>       Arrow::TimestampArray.new(:second,
[9] pry(main)>                                 [
[9] pry(main)>                                   @timestamp_2019_11_18_00_09_11,
[9] pry(main)>                                   nil,
[9] pry(main)>                                   @timestamp_2025_12_16_05_33_58,
[9] pry(main)>                                 ])
=> #<Arrow::TimestampArray:0x00000001211f2aa8 ptr=0x0000600003c582e0 [
  <value out of range: 1574003351000>,
  null,
  <value out of range: 1765863238000>
]>

end

def build_array
Arrow::TimestampArray.new(:second,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Arrow::TimestampArray.new(:second,
Arrow::TimestampArray.new(:nano,

@kou kou merged commit 97ea97c into apache:main Dec 17, 2025
9 checks passed
@kou kou deleted the ruby-timestamp-array branch December 17, 2025 00:55
@kou kou removed the awaiting committer review Awaiting committer review label Dec 17, 2025
@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 97ea97c.

There was 1 benchmark result with an error:

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants