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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90ffcadf5b78e4ffc3329eac9be1be34af9209a77a39a6395eefc1c56afa7ce6
4
- data.tar.gz: 1d7f5257d3f86443e0d13b789d7449565198f6cda1563d111a36ad3728264044
3
+ metadata.gz: 1805a7356005e238c3d8f4318a54ea498ff58a0fcd93819c51cc445c4f8b6ee0
4
+ data.tar.gz: 1360c3d481eac282e684f588e49cbcd142c7cc0f6c345d8a98e48e402a9edf22
5
5
  SHA512:
6
- metadata.gz: 262039094dd3aa5890f9d1a87d836eb64004c51fc57456d7880a36332295ac8a447fcd045c6bd2e053986ad4e9981021448b39e20010d0e41fef6b7e233d91ca
7
- data.tar.gz: 73988e1f836acbe22e26c20b8559d8f79e9eeda55f9612fbefae7aa5bef131187b7a0716a3bd7804db5321b29b19f54b383e8594830814ae765d2c7b30986f59
6
+ metadata.gz: 28c157c39f25744a10223e8d11d165b7e4e25eb70e45cf2e22513795b4b1b4b1b9f44bc04d5ef8e10b74ebd82d1c87bc318a02b32fc25dbd6c32c0763e79801c
7
+ data.tar.gz: 6f0433e8090c49c48278bcd4d5f36f96c394bd8d8386fbf2bc22d224d42ef58036beaa0307c32420cbbb3b33eec463964b28e616f862385de6afa1f8c98c9310
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parqueteur (1.1.0)
4
+ parqueteur (1.1.1)
5
5
  red-parquet (~> 5.0)
6
6
 
7
7
  GEM
@@ -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(100) do |items|
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parqueteur
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parqueteur
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien D.