red-arrow 15.0.2 → 16.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da8b7abd976ec789610864f01108ed11f819c7f4f3fb89ddc2df953457690932
|
4
|
+
data.tar.gz: 332e1e80b4b71b34300c473d4e92d4207124205312b520ab6a0f55ca8fbe7ff4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de80fc835bb774e3eb7e83039447aac4dfccf6b9c12d83d0b4b7e583357665a186d99f2fd8b8bd79890caf87f71c7bcd83c9b09231f598e1b7394d622c51864a
|
7
|
+
data.tar.gz: f60d05c58897f02dd72770951a482ea79625b44559f8d213b7fabc49e2fef7bc1297985e8dd7f72dfd14cdeff58010bf4ddf688bdca283edc8493e6ecd5a6f0b
|
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,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: red-arrow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 16.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Apache Arrow Developers
|
8
|
+
autorequire:
|
8
9
|
bindir: bin
|
9
10
|
cert_chain: []
|
10
|
-
date: 2024-
|
11
|
+
date: 2024-05-27 00:00:00.000000000 Z
|
11
12
|
dependencies:
|
12
13
|
- !ruby/object:Gem::Dependency
|
13
14
|
name: bigdecimal
|
@@ -227,6 +228,7 @@ files:
|
|
227
228
|
- lib/arrow/timestamp-array-builder.rb
|
228
229
|
- lib/arrow/timestamp-array.rb
|
229
230
|
- lib/arrow/timestamp-data-type.rb
|
231
|
+
- lib/arrow/timestamp-parser.rb
|
230
232
|
- lib/arrow/union-array-builder.rb
|
231
233
|
- lib/arrow/version.rb
|
232
234
|
- lib/arrow/writable.rb
|
@@ -346,7 +348,8 @@ homepage: https://arrow.apache.org/
|
|
346
348
|
licenses:
|
347
349
|
- Apache-2.0
|
348
350
|
metadata:
|
349
|
-
msys2_mingw_dependencies: arrow>=
|
351
|
+
msys2_mingw_dependencies: arrow>=16.1.0
|
352
|
+
post_install_message:
|
350
353
|
rdoc_options: []
|
351
354
|
require_paths:
|
352
355
|
- lib
|
@@ -361,7 +364,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
361
364
|
- !ruby/object:Gem::Version
|
362
365
|
version: '0'
|
363
366
|
requirements: []
|
364
|
-
rubygems_version: 3.
|
367
|
+
rubygems_version: 3.3.5
|
368
|
+
signing_key:
|
365
369
|
specification_version: 4
|
366
370
|
summary: Red Arrow is the Ruby bindings of Apache Arrow
|
367
371
|
test_files:
|