red-arrow 18.1.0 → 19.0.1

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.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/lib/arrow/array.rb +7 -4
  3. data/lib/arrow/column.rb +4 -4
  4. data/lib/arrow/jruby/array-builder.rb +114 -0
  5. data/lib/arrow/jruby/array.rb +109 -0
  6. data/{test/helper/fixture.rb → lib/arrow/jruby/chunked-array.rb} +14 -6
  7. data/lib/arrow/jruby/compression-type.rb +26 -0
  8. data/{test/test-boolean-scalar.rb → lib/arrow/jruby/csv-read-options.rb} +12 -6
  9. data/{test/test-map-data-type.rb → lib/arrow/jruby/data-type.rb} +24 -12
  10. data/lib/arrow/jruby/decimal128.rb +28 -0
  11. data/lib/arrow/jruby/decimal256.rb +28 -0
  12. data/{test/fixture/null-with-double-quote.csv → lib/arrow/jruby/error.rb} +7 -4
  13. data/lib/arrow/jruby/file-system.rb +24 -0
  14. data/{test/test-null-array.rb → lib/arrow/jruby/function.rb} +5 -4
  15. data/lib/arrow/jruby/record-batch-iterator.rb +24 -0
  16. data/{test/fixture/integer-float.csv → lib/arrow/jruby/record-batch.rb} +8 -4
  17. data/{test/fixture/float-integer.csv → lib/arrow/jruby/sort-key.rb} +8 -4
  18. data/lib/arrow/jruby/sort-options.rb +24 -0
  19. data/lib/arrow/jruby/stream-listener-raw.rb +25 -0
  20. data/{test/test-rolling-window.rb → lib/arrow/jruby/table.rb} +19 -19
  21. data/lib/arrow/jruby/writable.rb +24 -0
  22. data/lib/arrow/jruby.rb +52 -0
  23. data/lib/arrow/libraries.rb +126 -0
  24. data/lib/arrow/list-array-builder.rb +1 -0
  25. data/lib/arrow/loader.rb +3 -111
  26. data/{test/fixture/null-without-double-quote.csv → lib/arrow/ruby.rb} +6 -4
  27. data/lib/arrow/version.rb +1 -1
  28. data/lib/arrow.rb +2 -7
  29. data/red-arrow.gemspec +15 -6
  30. metadata +26 -229
  31. data/test/each-raw-record/test-basic-arrays.rb +0 -411
  32. data/test/each-raw-record/test-dense-union-array.rb +0 -566
  33. data/test/each-raw-record/test-dictionary-array.rb +0 -341
  34. data/test/each-raw-record/test-list-array.rb +0 -628
  35. data/test/each-raw-record/test-map-array.rb +0 -507
  36. data/test/each-raw-record/test-multiple-columns.rb +0 -72
  37. data/test/each-raw-record/test-sparse-union-array.rb +0 -528
  38. data/test/each-raw-record/test-struct-array.rb +0 -529
  39. data/test/each-raw-record/test-table.rb +0 -47
  40. data/test/fixture/TestOrcFile.test1.orc +0 -0
  41. data/test/fixture/with-header-float.csv +0 -20
  42. data/test/fixture/with-header.csv +0 -20
  43. data/test/fixture/without-header-float.csv +0 -19
  44. data/test/fixture/without-header.csv +0 -19
  45. data/test/helper/omittable.rb +0 -49
  46. data/test/helper.rb +0 -31
  47. data/test/raw-records/test-basic-arrays.rb +0 -405
  48. data/test/raw-records/test-dense-union-array.rb +0 -566
  49. data/test/raw-records/test-dictionary-array.rb +0 -341
  50. data/test/raw-records/test-list-array.rb +0 -628
  51. data/test/raw-records/test-map-array.rb +0 -507
  52. data/test/raw-records/test-multiple-columns.rb +0 -65
  53. data/test/raw-records/test-sparse-union-array.rb +0 -556
  54. data/test/raw-records/test-struct-array.rb +0 -529
  55. data/test/raw-records/test-table.rb +0 -47
  56. data/test/run-test.rb +0 -71
  57. data/test/test-array-builder.rb +0 -198
  58. data/test/test-array.rb +0 -332
  59. data/test/test-bigdecimal.rb +0 -40
  60. data/test/test-binary-dictionary-array-builder.rb +0 -103
  61. data/test/test-buffer.rb +0 -49
  62. data/test/test-chunked-array.rb +0 -198
  63. data/test/test-column.rb +0 -123
  64. data/test/test-csv-loader.rb +0 -297
  65. data/test/test-data-type.rb +0 -84
  66. data/test/test-date32-array.rb +0 -24
  67. data/test/test-date64-array.rb +0 -25
  68. data/test/test-decimal128-array-builder.rb +0 -126
  69. data/test/test-decimal128-array.rb +0 -47
  70. data/test/test-decimal128-data-type.rb +0 -31
  71. data/test/test-decimal128.rb +0 -126
  72. data/test/test-decimal256-array-builder.rb +0 -126
  73. data/test/test-decimal256-array.rb +0 -47
  74. data/test/test-decimal256-data-type.rb +0 -31
  75. data/test/test-decimal256.rb +0 -126
  76. data/test/test-dense-union-array.rb +0 -42
  77. data/test/test-dense-union-data-type.rb +0 -41
  78. data/test/test-dictionary-array.rb +0 -41
  79. data/test/test-dictionary-data-type.rb +0 -40
  80. data/test/test-expression.rb +0 -51
  81. data/test/test-feather.rb +0 -49
  82. data/test/test-field.rb +0 -117
  83. data/test/test-file-output-stream.rb +0 -54
  84. data/test/test-fixed-size-binary-array-builder.rb +0 -92
  85. data/test/test-fixed-size-binary-array.rb +0 -36
  86. data/test/test-float-scalar.rb +0 -46
  87. data/test/test-function.rb +0 -210
  88. data/test/test-group.rb +0 -193
  89. data/test/test-half-float-array.rb +0 -43
  90. data/test/test-half-float.rb +0 -130
  91. data/test/test-list-array-builder.rb +0 -79
  92. data/test/test-list-array.rb +0 -32
  93. data/test/test-list-data-type.rb +0 -69
  94. data/test/test-map-array-builder.rb +0 -110
  95. data/test/test-map-array.rb +0 -33
  96. data/test/test-memory-view.rb +0 -434
  97. data/test/test-orc.rb +0 -173
  98. data/test/test-ractor.rb +0 -34
  99. data/test/test-record-batch-builder.rb +0 -125
  100. data/test/test-record-batch-file-reader.rb +0 -136
  101. data/test/test-record-batch-iterator.rb +0 -37
  102. data/test/test-record-batch-reader.rb +0 -46
  103. data/test/test-record-batch-stream-reader.rb +0 -129
  104. data/test/test-record-batch.rb +0 -182
  105. data/test/test-scalar.rb +0 -65
  106. data/test/test-schema.rb +0 -134
  107. data/test/test-slicer.rb +0 -589
  108. data/test/test-sort-indices.rb +0 -40
  109. data/test/test-sort-key.rb +0 -81
  110. data/test/test-sort-options.rb +0 -58
  111. data/test/test-sparse-union-array.rb +0 -38
  112. data/test/test-sparse-union-data-type.rb +0 -41
  113. data/test/test-stream-listener.rb +0 -60
  114. data/test/test-string-dictionary-array-builder.rb +0 -103
  115. data/test/test-struct-array-builder.rb +0 -184
  116. data/test/test-struct-array.rb +0 -94
  117. data/test/test-struct-data-type.rb +0 -112
  118. data/test/test-table.rb +0 -1530
  119. data/test/test-tensor.rb +0 -297
  120. data/test/test-time.rb +0 -288
  121. data/test/test-time32-array.rb +0 -81
  122. data/test/test-time32-data-type.rb +0 -42
  123. data/test/test-time64-array.rb +0 -81
  124. data/test/test-time64-data-type.rb +0 -42
  125. data/test/test-timestamp-array.rb +0 -45
  126. data/test/test-timestamp-data-type.rb +0 -42
  127. data/test/values/test-basic-arrays.rb +0 -335
  128. data/test/values/test-dense-union-array.rb +0 -552
  129. data/test/values/test-dictionary-array.rb +0 -325
  130. data/test/values/test-list-array.rb +0 -587
  131. data/test/values/test-map-array.rb +0 -489
  132. data/test/values/test-sparse-union-array.rb +0 -543
  133. data/test/values/test-struct-array.rb +0 -524
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: red-arrow
3
3
  version: !ruby/object:Gem::Version
4
- version: 18.1.0
4
+ version: 19.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apache Arrow Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-27 00:00:00.000000000 Z
11
+ date: 2025-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal
@@ -172,6 +172,26 @@ files:
172
172
  - lib/arrow/half-float-array.rb
173
173
  - lib/arrow/half-float.rb
174
174
  - lib/arrow/input-referable.rb
175
+ - lib/arrow/jruby.rb
176
+ - lib/arrow/jruby/array-builder.rb
177
+ - lib/arrow/jruby/array.rb
178
+ - lib/arrow/jruby/chunked-array.rb
179
+ - lib/arrow/jruby/compression-type.rb
180
+ - lib/arrow/jruby/csv-read-options.rb
181
+ - lib/arrow/jruby/data-type.rb
182
+ - lib/arrow/jruby/decimal128.rb
183
+ - lib/arrow/jruby/decimal256.rb
184
+ - lib/arrow/jruby/error.rb
185
+ - lib/arrow/jruby/file-system.rb
186
+ - lib/arrow/jruby/function.rb
187
+ - lib/arrow/jruby/record-batch-iterator.rb
188
+ - lib/arrow/jruby/record-batch.rb
189
+ - lib/arrow/jruby/sort-key.rb
190
+ - lib/arrow/jruby/sort-options.rb
191
+ - lib/arrow/jruby/stream-listener-raw.rb
192
+ - lib/arrow/jruby/table.rb
193
+ - lib/arrow/jruby/writable.rb
194
+ - lib/arrow/libraries.rb
175
195
  - lib/arrow/list-array-builder.rb
176
196
  - lib/arrow/list-data-type.rb
177
197
  - lib/arrow/loader.rb
@@ -193,6 +213,7 @@ files:
193
213
  - lib/arrow/record-containable.rb
194
214
  - lib/arrow/record.rb
195
215
  - lib/arrow/rolling-window.rb
216
+ - lib/arrow/ruby.rb
196
217
  - lib/arrow/s3-global-options.rb
197
218
  - lib/arrow/scalar.rb
198
219
  - lib/arrow/schema.rb
@@ -235,123 +256,11 @@ files:
235
256
  - lib/arrow/version.rb
236
257
  - lib/arrow/writable.rb
237
258
  - red-arrow.gemspec
238
- - test/each-raw-record/test-basic-arrays.rb
239
- - test/each-raw-record/test-dense-union-array.rb
240
- - test/each-raw-record/test-dictionary-array.rb
241
- - test/each-raw-record/test-list-array.rb
242
- - test/each-raw-record/test-map-array.rb
243
- - test/each-raw-record/test-multiple-columns.rb
244
- - test/each-raw-record/test-sparse-union-array.rb
245
- - test/each-raw-record/test-struct-array.rb
246
- - test/each-raw-record/test-table.rb
247
- - test/fixture/TestOrcFile.test1.orc
248
- - test/fixture/float-integer.csv
249
- - test/fixture/integer-float.csv
250
- - test/fixture/null-with-double-quote.csv
251
- - test/fixture/null-without-double-quote.csv
252
- - test/fixture/with-header-float.csv
253
- - test/fixture/with-header.csv
254
- - test/fixture/without-header-float.csv
255
- - test/fixture/without-header.csv
256
- - test/helper.rb
257
- - test/helper/fixture.rb
258
- - test/helper/omittable.rb
259
- - test/raw-records/test-basic-arrays.rb
260
- - test/raw-records/test-dense-union-array.rb
261
- - test/raw-records/test-dictionary-array.rb
262
- - test/raw-records/test-list-array.rb
263
- - test/raw-records/test-map-array.rb
264
- - test/raw-records/test-multiple-columns.rb
265
- - test/raw-records/test-sparse-union-array.rb
266
- - test/raw-records/test-struct-array.rb
267
- - test/raw-records/test-table.rb
268
- - test/run-test.rb
269
- - test/test-array-builder.rb
270
- - test/test-array.rb
271
- - test/test-bigdecimal.rb
272
- - test/test-binary-dictionary-array-builder.rb
273
- - test/test-boolean-scalar.rb
274
- - test/test-buffer.rb
275
- - test/test-chunked-array.rb
276
- - test/test-column.rb
277
- - test/test-csv-loader.rb
278
- - test/test-data-type.rb
279
- - test/test-date32-array.rb
280
- - test/test-date64-array.rb
281
- - test/test-decimal128-array-builder.rb
282
- - test/test-decimal128-array.rb
283
- - test/test-decimal128-data-type.rb
284
- - test/test-decimal128.rb
285
- - test/test-decimal256-array-builder.rb
286
- - test/test-decimal256-array.rb
287
- - test/test-decimal256-data-type.rb
288
- - test/test-decimal256.rb
289
- - test/test-dense-union-array.rb
290
- - test/test-dense-union-data-type.rb
291
- - test/test-dictionary-array.rb
292
- - test/test-dictionary-data-type.rb
293
- - test/test-expression.rb
294
- - test/test-feather.rb
295
- - test/test-field.rb
296
- - test/test-file-output-stream.rb
297
- - test/test-fixed-size-binary-array-builder.rb
298
- - test/test-fixed-size-binary-array.rb
299
- - test/test-float-scalar.rb
300
- - test/test-function.rb
301
- - test/test-group.rb
302
- - test/test-half-float-array.rb
303
- - test/test-half-float.rb
304
- - test/test-list-array-builder.rb
305
- - test/test-list-array.rb
306
- - test/test-list-data-type.rb
307
- - test/test-map-array-builder.rb
308
- - test/test-map-array.rb
309
- - test/test-map-data-type.rb
310
- - test/test-memory-view.rb
311
- - test/test-null-array.rb
312
- - test/test-orc.rb
313
- - test/test-ractor.rb
314
- - test/test-record-batch-builder.rb
315
- - test/test-record-batch-file-reader.rb
316
- - test/test-record-batch-iterator.rb
317
- - test/test-record-batch-reader.rb
318
- - test/test-record-batch-stream-reader.rb
319
- - test/test-record-batch.rb
320
- - test/test-rolling-window.rb
321
- - test/test-scalar.rb
322
- - test/test-schema.rb
323
- - test/test-slicer.rb
324
- - test/test-sort-indices.rb
325
- - test/test-sort-key.rb
326
- - test/test-sort-options.rb
327
- - test/test-sparse-union-array.rb
328
- - test/test-sparse-union-data-type.rb
329
- - test/test-stream-listener.rb
330
- - test/test-string-dictionary-array-builder.rb
331
- - test/test-struct-array-builder.rb
332
- - test/test-struct-array.rb
333
- - test/test-struct-data-type.rb
334
- - test/test-table.rb
335
- - test/test-tensor.rb
336
- - test/test-time.rb
337
- - test/test-time32-array.rb
338
- - test/test-time32-data-type.rb
339
- - test/test-time64-array.rb
340
- - test/test-time64-data-type.rb
341
- - test/test-timestamp-array.rb
342
- - test/test-timestamp-data-type.rb
343
- - test/values/test-basic-arrays.rb
344
- - test/values/test-dense-union-array.rb
345
- - test/values/test-dictionary-array.rb
346
- - test/values/test-list-array.rb
347
- - test/values/test-map-array.rb
348
- - test/values/test-sparse-union-array.rb
349
- - test/values/test-struct-array.rb
350
259
  homepage: https://arrow.apache.org/
351
260
  licenses:
352
261
  - Apache-2.0
353
262
  metadata:
354
- msys2_mingw_dependencies: arrow>=18.1.0
263
+ msys2_mingw_dependencies: arrow>=19.0.1
355
264
  post_install_message:
356
265
  rdoc_options: []
357
266
  require_paths:
@@ -367,120 +276,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
276
  - !ruby/object:Gem::Version
368
277
  version: '0'
369
278
  requirements: []
370
- rubygems_version: 3.5.23
279
+ rubygems_version: 3.5.16
371
280
  signing_key:
372
281
  specification_version: 4
373
282
  summary: Red Arrow is the Ruby bindings of Apache Arrow
374
- test_files:
375
- - test/each-raw-record/test-basic-arrays.rb
376
- - test/each-raw-record/test-dense-union-array.rb
377
- - test/each-raw-record/test-dictionary-array.rb
378
- - test/each-raw-record/test-list-array.rb
379
- - test/each-raw-record/test-map-array.rb
380
- - test/each-raw-record/test-multiple-columns.rb
381
- - test/each-raw-record/test-sparse-union-array.rb
382
- - test/each-raw-record/test-struct-array.rb
383
- - test/each-raw-record/test-table.rb
384
- - test/fixture/TestOrcFile.test1.orc
385
- - test/fixture/float-integer.csv
386
- - test/fixture/integer-float.csv
387
- - test/fixture/null-with-double-quote.csv
388
- - test/fixture/null-without-double-quote.csv
389
- - test/fixture/with-header-float.csv
390
- - test/fixture/with-header.csv
391
- - test/fixture/without-header-float.csv
392
- - test/fixture/without-header.csv
393
- - test/helper/fixture.rb
394
- - test/helper/omittable.rb
395
- - test/helper.rb
396
- - test/raw-records/test-basic-arrays.rb
397
- - test/raw-records/test-dense-union-array.rb
398
- - test/raw-records/test-dictionary-array.rb
399
- - test/raw-records/test-list-array.rb
400
- - test/raw-records/test-map-array.rb
401
- - test/raw-records/test-multiple-columns.rb
402
- - test/raw-records/test-sparse-union-array.rb
403
- - test/raw-records/test-struct-array.rb
404
- - test/raw-records/test-table.rb
405
- - test/run-test.rb
406
- - test/test-array-builder.rb
407
- - test/test-array.rb
408
- - test/test-bigdecimal.rb
409
- - test/test-binary-dictionary-array-builder.rb
410
- - test/test-boolean-scalar.rb
411
- - test/test-buffer.rb
412
- - test/test-chunked-array.rb
413
- - test/test-column.rb
414
- - test/test-csv-loader.rb
415
- - test/test-data-type.rb
416
- - test/test-date32-array.rb
417
- - test/test-date64-array.rb
418
- - test/test-decimal128-array-builder.rb
419
- - test/test-decimal128-array.rb
420
- - test/test-decimal128-data-type.rb
421
- - test/test-decimal128.rb
422
- - test/test-decimal256-array-builder.rb
423
- - test/test-decimal256-array.rb
424
- - test/test-decimal256-data-type.rb
425
- - test/test-decimal256.rb
426
- - test/test-dense-union-array.rb
427
- - test/test-dense-union-data-type.rb
428
- - test/test-dictionary-array.rb
429
- - test/test-dictionary-data-type.rb
430
- - test/test-expression.rb
431
- - test/test-feather.rb
432
- - test/test-field.rb
433
- - test/test-file-output-stream.rb
434
- - test/test-fixed-size-binary-array-builder.rb
435
- - test/test-fixed-size-binary-array.rb
436
- - test/test-float-scalar.rb
437
- - test/test-function.rb
438
- - test/test-group.rb
439
- - test/test-half-float-array.rb
440
- - test/test-half-float.rb
441
- - test/test-list-array-builder.rb
442
- - test/test-list-array.rb
443
- - test/test-list-data-type.rb
444
- - test/test-map-array-builder.rb
445
- - test/test-map-array.rb
446
- - test/test-map-data-type.rb
447
- - test/test-memory-view.rb
448
- - test/test-null-array.rb
449
- - test/test-orc.rb
450
- - test/test-ractor.rb
451
- - test/test-record-batch-builder.rb
452
- - test/test-record-batch-file-reader.rb
453
- - test/test-record-batch-iterator.rb
454
- - test/test-record-batch-reader.rb
455
- - test/test-record-batch-stream-reader.rb
456
- - test/test-record-batch.rb
457
- - test/test-rolling-window.rb
458
- - test/test-scalar.rb
459
- - test/test-schema.rb
460
- - test/test-slicer.rb
461
- - test/test-sort-indices.rb
462
- - test/test-sort-key.rb
463
- - test/test-sort-options.rb
464
- - test/test-sparse-union-array.rb
465
- - test/test-sparse-union-data-type.rb
466
- - test/test-stream-listener.rb
467
- - test/test-string-dictionary-array-builder.rb
468
- - test/test-struct-array-builder.rb
469
- - test/test-struct-array.rb
470
- - test/test-struct-data-type.rb
471
- - test/test-table.rb
472
- - test/test-tensor.rb
473
- - test/test-time.rb
474
- - test/test-time32-array.rb
475
- - test/test-time32-data-type.rb
476
- - test/test-time64-array.rb
477
- - test/test-time64-data-type.rb
478
- - test/test-timestamp-array.rb
479
- - test/test-timestamp-data-type.rb
480
- - test/values/test-basic-arrays.rb
481
- - test/values/test-dense-union-array.rb
482
- - test/values/test-dictionary-array.rb
483
- - test/values/test-list-array.rb
484
- - test/values/test-map-array.rb
485
- - test/values/test-sparse-union-array.rb
486
- - test/values/test-struct-array.rb
283
+ test_files: []
@@ -1,411 +0,0 @@
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 EachRawRecordBasicArraysTests
19
- def test_null
20
- records = [
21
- [nil],
22
- [nil],
23
- [nil],
24
- ]
25
- target = build({column: :null}, records)
26
- assert_equal(records, target.each_raw_record.to_a)
27
- end
28
-
29
- def test_boolean
30
- records = [
31
- [true],
32
- [nil],
33
- [false],
34
- ]
35
- target = build({column: :boolean}, records)
36
- assert_equal(records, target.each_raw_record.to_a)
37
- end
38
-
39
- def test_int8
40
- records = [
41
- [-(2 ** 7)],
42
- [nil],
43
- [(2 ** 7) - 1],
44
- ]
45
- target = build({column: :int8}, records)
46
- assert_equal(records, target.each_raw_record.to_a)
47
- end
48
-
49
- def test_uint8
50
- records = [
51
- [0],
52
- [nil],
53
- [(2 ** 8) - 1],
54
- ]
55
- target = build({column: :uint8}, records)
56
- assert_equal(records, target.each_raw_record.to_a)
57
- end
58
-
59
- def test_int16
60
- records = [
61
- [-(2 ** 15)],
62
- [nil],
63
- [(2 ** 15) - 1],
64
- ]
65
- target = build({column: :int16}, records)
66
- assert_equal(records, target.each_raw_record.to_a)
67
- end
68
-
69
- def test_uint16
70
- records = [
71
- [0],
72
- [nil],
73
- [(2 ** 16) - 1],
74
- ]
75
- target = build({column: :uint16}, records)
76
- assert_equal(records, target.each_raw_record.to_a)
77
- end
78
-
79
- def test_int32
80
- records = [
81
- [-(2 ** 31)],
82
- [nil],
83
- [(2 ** 31) - 1],
84
- ]
85
- target = build({column: :int32}, records)
86
- assert_equal(records, target.each_raw_record.to_a)
87
- end
88
-
89
- def test_uint32
90
- records = [
91
- [0],
92
- [nil],
93
- [(2 ** 32) - 1],
94
- ]
95
- target = build({column: :uint32}, records)
96
- assert_equal(records, target.each_raw_record.to_a)
97
- end
98
-
99
- def test_int64
100
- records = [
101
- [-(2 ** 63)],
102
- [nil],
103
- [(2 ** 63) - 1],
104
- ]
105
- target = build({column: :int64}, records)
106
- assert_equal(records, target.each_raw_record.to_a)
107
- end
108
-
109
- def test_uint64
110
- records = [
111
- [0],
112
- [nil],
113
- [(2 ** 64) - 1],
114
- ]
115
- target = build({column: :uint64}, records)
116
- assert_equal(records, target.each_raw_record.to_a)
117
- end
118
-
119
- def test_half_float
120
- records = [
121
- [-1.5],
122
- [nil],
123
- [1.5],
124
- ]
125
- target = build({column: :half_float}, records)
126
- assert_equal(records, target.each_raw_record.to_a)
127
- end
128
-
129
- def test_float
130
- records = [
131
- [-1.0],
132
- [nil],
133
- [1.0],
134
- ]
135
- target = build({column: :float}, records)
136
- assert_equal(records, target.each_raw_record.to_a)
137
- end
138
-
139
- def test_double
140
- records = [
141
- [-1.0],
142
- [nil],
143
- [1.0],
144
- ]
145
- target = build({column: :double}, records)
146
- assert_equal(records, target.each_raw_record.to_a)
147
- end
148
-
149
- def test_binary
150
- records = [
151
- ["\x00".b],
152
- [nil],
153
- ["\xff".b],
154
- ]
155
- target = build({column: :binary}, records)
156
- assert_equal(records, target.each_raw_record.to_a)
157
- end
158
-
159
- def test_string
160
- records = [
161
- ["Ruby"],
162
- [nil],
163
- ["\u3042"], # U+3042 HIRAGANA LETTER A
164
- ]
165
- target = build({column: :string}, records)
166
- assert_equal(records, target.each_raw_record.to_a)
167
- end
168
-
169
- def test_date32
170
- records = [
171
- [Date.new(1960, 1, 1)],
172
- [nil],
173
- [Date.new(2017, 8, 23)],
174
- ]
175
- target = build({column: :date32}, records)
176
- assert_equal(records, target.each_raw_record.to_a)
177
- end
178
-
179
- def test_date64
180
- records = [
181
- [DateTime.new(1960, 1, 1, 2, 9, 30)],
182
- [nil],
183
- [DateTime.new(2017, 8, 23, 14, 57, 2)],
184
- ]
185
- target = build({column: :date64}, records)
186
- assert_equal(records, target.each_raw_record.to_a)
187
- end
188
-
189
- def test_timestamp_second
190
- records = [
191
- [Time.parse("1960-01-01T02:09:30Z")],
192
- [nil],
193
- [Time.parse("2017-08-23T14:57:02Z")],
194
- ]
195
- target = build({
196
- column: {
197
- type: :timestamp,
198
- unit: :second,
199
- }
200
- },
201
- records)
202
- assert_equal(records, target.each_raw_record.to_a)
203
- end
204
-
205
- def test_timestamp_milli
206
- records = [
207
- [Time.parse("1960-01-01T02:09:30.123Z")],
208
- [nil],
209
- [Time.parse("2017-08-23T14:57:02.987Z")],
210
- ]
211
- target = build({
212
- column: {
213
- type: :timestamp,
214
- unit: :milli,
215
- }
216
- },
217
- records)
218
- assert_equal(records, target.each_raw_record.to_a)
219
- end
220
-
221
- def test_timestamp_micro
222
- records = [
223
- [Time.parse("1960-01-01T02:09:30.123456Z")],
224
- [nil],
225
- [Time.parse("2017-08-23T14:57:02.987654Z")],
226
- ]
227
- target = build({
228
- column: {
229
- type: :timestamp,
230
- unit: :micro,
231
- }
232
- },
233
- records)
234
- assert_equal(records, target.each_raw_record.to_a)
235
- end
236
-
237
- def test_timestamp_nano
238
- records = [
239
- [Time.parse("1960-01-01T02:09:30.123456789Z")],
240
- [nil],
241
- [Time.parse("2017-08-23T14:57:02.987654321Z")],
242
- ]
243
- target = build({
244
- column: {
245
- type: :timestamp,
246
- unit: :nano,
247
- }
248
- },
249
- records)
250
- assert_equal(records, target.each_raw_record.to_a)
251
- end
252
-
253
- def test_time32_second
254
- unit = Arrow::TimeUnit::SECOND
255
- records = [
256
- [Arrow::Time.new(unit, 60 * 10)], # 00:10:00
257
- [nil],
258
- [Arrow::Time.new(unit, 60 * 60 * 2 + 9)], # 02:00:09
259
- ]
260
- target = build({
261
- column: {
262
- type: :time32,
263
- unit: :second,
264
- }
265
- },
266
- records)
267
- assert_equal(records, target.each_raw_record.to_a)
268
- end
269
-
270
- def test_time32_milli
271
- unit = Arrow::TimeUnit::MILLI
272
- records = [
273
- [Arrow::Time.new(unit, (60 * 10) * 1000 + 123)], # 00:10:00.123
274
- [nil],
275
- [Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1000 + 987)], # 02:00:09.987
276
- ]
277
- target = build({
278
- column: {
279
- type: :time32,
280
- unit: :milli,
281
- }
282
- },
283
- records)
284
- assert_equal(records, target.each_raw_record.to_a)
285
- end
286
-
287
- def test_time64_micro
288
- unit = Arrow::TimeUnit::MICRO
289
- records = [
290
- # 00:10:00.123456
291
- [Arrow::Time.new(unit, (60 * 10) * 1_000_000 + 123_456)],
292
- [nil],
293
- # 02:00:09.987654
294
- [Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1_000_000 + 987_654)],
295
- ]
296
- target = build({
297
- column: {
298
- type: :time64,
299
- unit: :micro,
300
- }
301
- },
302
- records)
303
- assert_equal(records, target.each_raw_record.to_a)
304
- end
305
-
306
- def test_time64_nano
307
- unit = Arrow::TimeUnit::NANO
308
- records = [
309
- # 00:10:00.123456789
310
- [Arrow::Time.new(unit, (60 * 10) * 1_000_000_000 + 123_456_789)],
311
- [nil],
312
- # 02:00:09.987654321
313
- [Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1_000_000_000 + 987_654_321)],
314
- ]
315
- target = build({
316
- column: {
317
- type: :time64,
318
- unit: :nano,
319
- }
320
- },
321
- records)
322
- assert_equal(records, target.each_raw_record.to_a)
323
- end
324
-
325
- def test_decimal128
326
- records = [
327
- [BigDecimal("92.92")],
328
- [nil],
329
- [BigDecimal("29.29")],
330
- ]
331
- target = build({
332
- column: {
333
- type: :decimal128,
334
- precision: 8,
335
- scale: 2,
336
- }
337
- },
338
- records)
339
- assert_equal(records, target.each_raw_record.to_a)
340
- end
341
-
342
- def test_decimal256
343
- records = [
344
- [BigDecimal("92.92")],
345
- [nil],
346
- [BigDecimal("29.29")],
347
- ]
348
- target = build({
349
- column: {
350
- type: :decimal256,
351
- precision: 38,
352
- scale: 2,
353
- }
354
- },
355
- records)
356
- assert_equal(records, target.each_raw_record.to_a)
357
- end
358
-
359
- def test_month_interval
360
- records = [
361
- [1],
362
- [nil],
363
- [12],
364
- ]
365
- target = build({column: :month_interval}, records)
366
- assert_equal(records, target.each_raw_record.to_a)
367
- end
368
-
369
- def test_day_time_interval
370
- records = [
371
- [{day: 1, millisecond: 100}],
372
- [nil],
373
- [{day: 2, millisecond: 300}],
374
- ]
375
- target = build({column: :day_time_interval}, records)
376
- assert_equal(records, target.each_raw_record.to_a)
377
- end
378
-
379
- def test_month_day_nano_interval
380
- records = [
381
- [{month: 1, day: 1, nanosecond: 100}],
382
- [nil],
383
- [{month: 2, day: 3, nanosecond: 400}],
384
- ]
385
- target = build({column: :month_day_nano_interval}, records)
386
- assert_equal(records, target.each_raw_record.to_a)
387
- end
388
- end
389
-
390
- class EachRawRecordRecordBatchBasicArraysTest< Test::Unit::TestCase
391
- include EachRawRecordBasicArraysTests
392
-
393
- def build(schema, records)
394
- Arrow::RecordBatch.new(schema, records)
395
- end
396
- end
397
-
398
- class EachRawRecordTableBasicArraysTest < Test::Unit::TestCase
399
- include EachRawRecordBasicArraysTests
400
-
401
- def build(schema, records)
402
- record_batch = Arrow::RecordBatch.new(schema, records)
403
- # Multiple chunks
404
- record_batches = [
405
- record_batch.slice(0, 2),
406
- record_batch.slice(2, 0), # Empty chunk
407
- record_batch.slice(2, record_batch.length - 2),
408
- ]
409
- Arrow::Table.new(schema, record_batches)
410
- end
411
- end