redshift-connector-data_file 1.0.0 → 1.1.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fab0d487a44643d1add17ce0323edab71ac75b8
|
4
|
+
data.tar.gz: b415428c7d55384f2c7ac9b83ea537947247dfbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8882dc7483274809e15bb4d6d1a7110aa5700946e300fb74399b3c895d7f0d1dd9a0aba7c61c6b5e0a5cf280251196efaa9022a89582111623898775a6910942
|
7
|
+
data.tar.gz: 0d5b894719f9ff572fcd9f4a6077adf7ed80ee6da8525a3dc77526a9403c243b32fb9b2337d450482f79b53fb81b5a37e44ae9a030829b4767ce10f5b72348bb
|
@@ -18,5 +18,36 @@ module RedshiftConnector
|
|
18
18
|
def all_data_objects
|
19
19
|
data_files.select {|obj| obj.data_object? }
|
20
20
|
end
|
21
|
+
|
22
|
+
REPORT_SIZE = 10_0000
|
23
|
+
|
24
|
+
def each_batch(report: true)
|
25
|
+
@logger.info "reader: #{@reader_class}"
|
26
|
+
n = 0
|
27
|
+
reported = 0
|
28
|
+
do_each_batch(@batch_size) do |rows|
|
29
|
+
yield rows
|
30
|
+
n += rows.size
|
31
|
+
if n / REPORT_SIZE > reported
|
32
|
+
@logger.info "#{n} rows processed" if report
|
33
|
+
reported = n / REPORT_SIZE
|
34
|
+
end
|
35
|
+
end
|
36
|
+
@logger.info "total #{n} rows processed" if report
|
37
|
+
end
|
38
|
+
|
39
|
+
def do_each_batch(batch_size)
|
40
|
+
filter = @filter
|
41
|
+
buf = []
|
42
|
+
each_row do |row|
|
43
|
+
buf.push filter.(*row)
|
44
|
+
if buf.size == batch_size
|
45
|
+
yield buf
|
46
|
+
buf = []
|
47
|
+
end
|
48
|
+
end
|
49
|
+
yield buf unless buf.empty?
|
50
|
+
end
|
51
|
+
private :do_each_batch
|
21
52
|
end
|
22
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redshift-connector-data_file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hidekazu Kobayashi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|