parqueteur 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/parqueteur/converter.rb +7 -3
- data/lib/parqueteur/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1805a7356005e238c3d8f4318a54ea498ff58a0fcd93819c51cc445c4f8b6ee0
|
4
|
+
data.tar.gz: 1360c3d481eac282e684f588e49cbcd142c7cc0f6c345d8a98e48e402a9edf22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28c157c39f25744a10223e8d11d165b7e4e25eb70e45cf2e22513795b4b1b4b1b9f44bc04d5ef8e10b74ebd82d1c87bc318a02b32fc25dbd6c32c0763e79801c
|
7
|
+
data.tar.gz: 6f0433e8090c49c48278bcd4d5f36f96c394bd8d8386fbf2bc22d224d42ef58036beaa0307c32420cbbb3b33eec463964b28e616f862385de6afa1f8c98c9310
|
data/Gemfile.lock
CHANGED
data/lib/parqueteur/converter.rb
CHANGED
@@ -4,6 +4,8 @@ module Parqueteur
|
|
4
4
|
class Converter
|
5
5
|
attr_reader :schema
|
6
6
|
|
7
|
+
DEFAULT_BATCH_SIZE = 25
|
8
|
+
|
7
9
|
def self.inline(&block)
|
8
10
|
Class.new(self, &block)
|
9
11
|
end
|
@@ -24,8 +26,8 @@ module Parqueteur
|
|
24
26
|
transforms << (method_name || block)
|
25
27
|
end
|
26
28
|
|
27
|
-
def self.convert(input, output: nil)
|
28
|
-
converter = new(input)
|
29
|
+
def self.convert(input, output: nil, batch_size: DEFAULT_BATCH_SIZE)
|
30
|
+
converter = new(input, bactch_size: batch_size)
|
29
31
|
if !output.nil?
|
30
32
|
converter.write(output)
|
31
33
|
else
|
@@ -35,6 +37,7 @@ module Parqueteur
|
|
35
37
|
|
36
38
|
def initialize(input, options = {})
|
37
39
|
@input = Parqueteur::Input.from(input, options)
|
40
|
+
@batch_size = options.fetch(:batch_size, DEFAULT_BATCH_SIZE)
|
38
41
|
end
|
39
42
|
|
40
43
|
def write(output)
|
@@ -72,8 +75,9 @@ module Parqueteur
|
|
72
75
|
chunks = self.class.columns.each_with_object({}) do |column, hash|
|
73
76
|
hash[column.name] = []
|
74
77
|
end
|
78
|
+
|
75
79
|
items_count = 0
|
76
|
-
@input.each_slice(
|
80
|
+
@input.each_slice(@batch_size) do |items|
|
77
81
|
values = self.class.columns.each_with_object({}) do |column, hash|
|
78
82
|
hash[column.name] = []
|
79
83
|
end
|
data/lib/parqueteur/version.rb
CHANGED