-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-48553: [Ruby] Add support for reading timestamp array #48554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
| attr_reader :unit | ||
| attr_reader :timezone | ||
| def initialize(unit, timezone) | ||
| super("Temporal") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Arrow::TimestampArray.new(:second, | |
| Arrow::TimestampArray.new(:micro, |
| end | ||
|
|
||
| def build_array | ||
| Arrow::TimestampArray.new(:second, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Arrow::TimestampArray.new(:second, | |
| Arrow::TimestampArray.new(:nano, |
|
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. |
Rationale for this change
It's an array for timestamp.
What changes are included in this PR?
ArrowFormat::TimestampTypeArrowFormat::TimestampArrayAre these changes tested?
Yes.
Are there any user-facing changes?
Yes.