red-arrow 15.0.1 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c240a7d115cb94464f4533524e1d3e780670515f134e18932bab704b678886dc
4
- data.tar.gz: b87890b494ca08fe170fed3a6617f7382376d545601c7cf6122c5b3dd8b29819
3
+ metadata.gz: 021e0bb1714a4dbaf54622b66dcea24682f78d2045497a8109148620f6090e83
4
+ data.tar.gz: 8c61eedc5f5f94011b3c7a37aed40583c8b94f36e2e91f86a1d8c76fbe768a5c
5
5
  SHA512:
6
- metadata.gz: 7a0cde63d10334e1ff26a97c43df97953f47f67f8f26240beeb9eec95ca664a751cf56767368612aac602857fbb626cfb91cc000cf7cf1d9971f432b305cbcf5
7
- data.tar.gz: 9cb25845895d751ea6c69605726a58ea401b43d97bc6e2e0f7786d0c9f86598f33256182dfdfc48908a094dec465d38f9e029be44877f032b12c8443318d62a6
6
+ metadata.gz: 73e30cc705260b29ab70be6f98ad30075a5d6c07878c4af25b1650d48d9d7b5df6a7884eaf0db98f4e20cfa8ca0e3a25c49c625fe64f5c8aa4bd529dd10c9b8c
7
+ data.tar.gz: 30c65035dcf46283e7e64533604c16dcba2dd1b54e00bb8b7dfd10e9ecb2c8440f32a5cfc6adf24bcd7bee5a159aeba110d180f1bdd2d5746f28f66cabb696a8
data/lib/arrow/loader.rb CHANGED
@@ -138,6 +138,7 @@ module Arrow
138
138
  require "arrow/timestamp-array"
139
139
  require "arrow/timestamp-array-builder"
140
140
  require "arrow/timestamp-data-type"
141
+ require "arrow/timestamp-parser"
141
142
  require "arrow/union-array-builder"
142
143
  require "arrow/writable"
143
144
  end
@@ -0,0 +1,33 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ class TimestampParser
20
+ class << self
21
+ def try_convert(value)
22
+ case value
23
+ when :iso8601
24
+ ISO8601TimestampParser.new
25
+ when String
26
+ StrptimeTimestampParser.new(value)
27
+ else
28
+ nil
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
data/lib/arrow/version.rb CHANGED
@@ -16,7 +16,7 @@
16
16
  # under the License.
17
17
 
18
18
  module Arrow
19
- VERSION = "15.0.1"
19
+ VERSION = "16.0.0"
20
20
 
21
21
  module Version
22
22
  numbers, TAG = VERSION.split("-")
@@ -37,5 +37,13 @@ module Helper
37
37
  GObjectIntrospection::Version::STRING
38
38
  omit(message)
39
39
  end
40
+
41
+ def require_glib(major, minor, micro)
42
+ return if GLib::Version.or_later?(major, minor, micro)
43
+ message =
44
+ "Require GLib #{major}.#{minor}.#{micro} or later: " +
45
+ GLib::Version::STRING
46
+ omit(message)
47
+ end
40
48
  end
41
49
  end
@@ -17,6 +17,7 @@
17
17
 
18
18
  class CSVLoaderTest < Test::Unit::TestCase
19
19
  include Helper::Fixture
20
+ include Helper::Omittable
20
21
 
21
22
  def load_csv(input)
22
23
  Arrow::CSVLoader.load(input, skip_lines: /^#/)
@@ -246,5 +247,43 @@ count
246
247
  encoding: encoding,
247
248
  compression: :gzip))
248
249
  end
250
+
251
+ sub_test_case(":timestamp_parsers") do
252
+ test(":iso8601") do
253
+ require_glib(2, 58, 0)
254
+ data_type = Arrow::TimestampDataType.new(:second,
255
+ GLib::TimeZone.new("UTC"))
256
+ timestamps = [
257
+ Time.iso8601("2024-03-16T23:54:12Z"),
258
+ Time.iso8601("2024-03-16T23:54:13Z"),
259
+ Time.iso8601("2024-03-16T23:54:14Z"),
260
+ ]
261
+ values = Arrow::TimestampArray.new(data_type, timestamps)
262
+ assert_equal(Arrow::Table.new(value: values),
263
+ load_csv(<<-CSV, headers: true, timestamp_parsers: [:iso8601]))
264
+ value
265
+ #{timestamps[0].iso8601}
266
+ #{timestamps[1].iso8601}
267
+ #{timestamps[2].iso8601}
268
+ CSV
269
+ end
270
+
271
+ test("String") do
272
+ timestamps = [
273
+ Time.iso8601("2024-03-16T23:54:12Z"),
274
+ Time.iso8601("2024-03-16T23:54:13Z"),
275
+ Time.iso8601("2024-03-16T23:54:14Z"),
276
+ ]
277
+ values = Arrow::TimestampArray.new(:second, timestamps)
278
+ format = "%Y-%m-%dT%H:%M:%S"
279
+ assert_equal(Arrow::Table.new(value: values).schema,
280
+ load_csv(<<-CSV, headers: true, timestamp_parsers: [format]).schema)
281
+ value
282
+ #{timestamps[0].iso8601.chomp("Z")}
283
+ #{timestamps[1].iso8601.chomp("Z")}
284
+ #{timestamps[2].iso8601.chomp("Z")}
285
+ CSV
286
+ end
287
+ end
249
288
  end
250
289
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: red-arrow
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.0.1
4
+ version: 16.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apache Arrow Developers
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-03-08 00:00:00.000000000 Z
10
+ date: 2024-04-26 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bigdecimal
@@ -228,6 +227,7 @@ files:
228
227
  - lib/arrow/timestamp-array-builder.rb
229
228
  - lib/arrow/timestamp-array.rb
230
229
  - lib/arrow/timestamp-data-type.rb
230
+ - lib/arrow/timestamp-parser.rb
231
231
  - lib/arrow/union-array-builder.rb
232
232
  - lib/arrow/version.rb
233
233
  - lib/arrow/writable.rb
@@ -347,8 +347,7 @@ homepage: https://arrow.apache.org/
347
347
  licenses:
348
348
  - Apache-2.0
349
349
  metadata:
350
- msys2_mingw_dependencies: arrow>=15.0.1
351
- post_install_message:
350
+ msys2_mingw_dependencies: arrow>=16.0.0
352
351
  rdoc_options: []
353
352
  require_paths:
354
353
  - lib
@@ -363,8 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
363
362
  - !ruby/object:Gem::Version
364
363
  version: '0'
365
364
  requirements: []
366
- rubygems_version: 3.3.5
367
- signing_key:
365
+ rubygems_version: 3.6.0.dev
368
366
  specification_version: 4
369
367
  summary: Red Arrow is the Ruby bindings of Apache Arrow
370
368
  test_files: