red-arrow 15.0.2 → 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 +4 -4
- data/lib/arrow/loader.rb +1 -0
- data/lib/arrow/timestamp-parser.rb +33 -0
- data/lib/arrow/version.rb +1 -1
- data/test/helper/omittable.rb +8 -0
- data/test/test-csv-loader.rb +39 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 021e0bb1714a4dbaf54622b66dcea24682f78d2045497a8109148620f6090e83
|
4
|
+
data.tar.gz: 8c61eedc5f5f94011b3c7a37aed40583c8b94f36e2e91f86a1d8c76fbe768a5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73e30cc705260b29ab70be6f98ad30075a5d6c07878c4af25b1650d48d9d7b5df6a7884eaf0db98f4e20cfa8ca0e3a25c49c625fe64f5c8aa4bd529dd10c9b8c
|
7
|
+
data.tar.gz: 30c65035dcf46283e7e64533604c16dcba2dd1b54e00bb8b7dfd10e9ecb2c8440f32a5cfc6adf24bcd7bee5a159aeba110d180f1bdd2d5746f28f66cabb696a8
|
data/lib/arrow/loader.rb
CHANGED
@@ -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
data/test/helper/omittable.rb
CHANGED
@@ -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
|
data/test/test-csv-loader.rb
CHANGED
@@ -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:
|
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-
|
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>=
|
350
|
+
msys2_mingw_dependencies: arrow>=16.0.0
|
350
351
|
rdoc_options: []
|
351
352
|
require_paths:
|
352
353
|
- lib
|