red-arrow 15.0.2 → 16.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3865fcd107813614a0634ef579c732ede335dbac693d549b305f25337fe94e2
4
- data.tar.gz: 969de41cd8cb2dcc0cd5ab588186d920d5374989b1ef316bff0c32702997b89d
3
+ metadata.gz: 021e0bb1714a4dbaf54622b66dcea24682f78d2045497a8109148620f6090e83
4
+ data.tar.gz: 8c61eedc5f5f94011b3c7a37aed40583c8b94f36e2e91f86a1d8c76fbe768a5c
5
5
  SHA512:
6
- metadata.gz: 279328938b7d880d0e1f91e7ca85768cff81bf141ec23eb015874e55ab3dae6c4c99b0d2a3c3cb768eefd68ceb20246123219cd8e3a76bcfc8ab1b79979ab544
7
- data.tar.gz: ff944c2871f18b361dd1dfe04c4fd0fcccf098aa95739a2fa18a681d1b160ae36be1fde045d089e4e957872555f50fc66a35efcedad627f028494db3aae817c2
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.2"
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,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: red-arrow
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.0.2
4
+ version: 16.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apache Arrow Developers
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2024-04-04 00:00:00.000000000 Z
10
+ date: 2024-04-26 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bigdecimal
@@ -227,6 +227,7 @@ files:
227
227
  - lib/arrow/timestamp-array-builder.rb
228
228
  - lib/arrow/timestamp-array.rb
229
229
  - lib/arrow/timestamp-data-type.rb
230
+ - lib/arrow/timestamp-parser.rb
230
231
  - lib/arrow/union-array-builder.rb
231
232
  - lib/arrow/version.rb
232
233
  - lib/arrow/writable.rb
@@ -346,7 +347,7 @@ homepage: https://arrow.apache.org/
346
347
  licenses:
347
348
  - Apache-2.0
348
349
  metadata:
349
- msys2_mingw_dependencies: arrow>=15.0.2
350
+ msys2_mingw_dependencies: arrow>=16.0.0
350
351
  rdoc_options: []
351
352
  require_paths:
352
353
  - lib