dataflow-rb 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/console +1 -1
- data/lib/dataflow-rb.rb +1 -1
- data/lib/dataflow/adapters/sql_adapter.rb +2 -0
- data/lib/dataflow/nodes/compute_node.rb +7 -2
- data/lib/dataflow/nodes/join_node.rb +2 -2
- data/lib/dataflow/nodes/select_keys_node.rb +5 -6
- data/lib/dataflow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 414f1c416fbd86a60fbc37db119f2c34a511486a
|
4
|
+
data.tar.gz: 2c63094740e4fcde2dddfdd7344c3fd90b1893b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '028244e631dd52380ebbe9fc4a3b2c9709ee97e883becbadf07d1cd0142a34de4aacb6e497f5572e04bd41ba9f7b4131134039c8a5c428f499a57690f4e72c76'
|
7
|
+
data.tar.gz: 3f22f68c3f703749b0b2d54bb98210081efbcca2c48dd4272f5b08f478c78d504ba97c15a52eca4129e569e03cc8a961fc6d01254dfef135a436c1d9993b5418
|
data/bin/console
CHANGED
data/lib/dataflow-rb.rb
CHANGED
@@ -47,7 +47,7 @@ require 'dataflow/nodes/filter/where_node'
|
|
47
47
|
require 'dataflow/nodes/transformation/to_time_node'
|
48
48
|
|
49
49
|
unless defined?(Rails) || Mongoid.configured?
|
50
|
-
env =
|
50
|
+
env = ENV['MONGOID_ENV'] || 'default'
|
51
51
|
# setup mongoid for stand-alone usage
|
52
52
|
config_file_path = File.join(File.dirname(__FILE__), 'config', 'mongoid.yml')
|
53
53
|
Mongoid.load!(config_file_path, env)
|
@@ -16,7 +16,7 @@ module Dataflow
|
|
16
16
|
|
17
17
|
delegate :find, :all, :all_paginated, :count, :ordered_system_id_queries,
|
18
18
|
:db_backend, :db_name, :use_symbols?,
|
19
|
-
:
|
19
|
+
:read_dataset_name, :write_dataset_name,
|
20
20
|
to: :data_node
|
21
21
|
|
22
22
|
#############################################
|
@@ -300,6 +300,11 @@ module Dataflow
|
|
300
300
|
release_computing_lock!
|
301
301
|
end
|
302
302
|
|
303
|
+
# Keep a compatible interface with the data node
|
304
|
+
def schema
|
305
|
+
required_schema
|
306
|
+
end
|
307
|
+
|
303
308
|
private
|
304
309
|
|
305
310
|
# Compute implementation:
|
@@ -390,7 +395,7 @@ module Dataflow
|
|
390
395
|
|
391
396
|
# Override to define a required schema.
|
392
397
|
def required_schema
|
393
|
-
schema
|
398
|
+
data_node&.schema
|
394
399
|
end
|
395
400
|
|
396
401
|
def send_heartbeat
|
@@ -35,9 +35,9 @@ module Dataflow
|
|
35
35
|
|
36
36
|
# merge both dependencies schemas
|
37
37
|
sch1 = dependencies.first.schema || {}
|
38
|
-
sch1 = sch1.select { |k,v| select_keys1.include?(k) } if select_keys1.present?
|
38
|
+
sch1 = sch1.select { |k,v| select_keys1.include?(k.to_s) } if select_keys1.present?
|
39
39
|
sch2 = dependencies.second.schema || {}
|
40
|
-
sch2 = sch2.select { |k,v| select_keys2.include?(k) } if select_keys2.present?
|
40
|
+
sch2 = sch2.select { |k,v| select_keys2.include?(k.to_s) } if select_keys2.present?
|
41
41
|
sch = sch1.merge(sch2)
|
42
42
|
|
43
43
|
sch
|
@@ -15,16 +15,15 @@ module Dataflow
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def compute_batch(records:)
|
18
|
-
|
19
|
-
|
20
|
-
select_keys(records: records, keys: k)
|
18
|
+
keys_tokens = keys.map { |k| [k, record_dig_tokens(key: k, use_sym: dependencies.first.use_symbols?)] }
|
19
|
+
select_keys(records: records, keys_tokens: keys_tokens)
|
21
20
|
end
|
22
21
|
|
23
|
-
def select_keys(records:,
|
22
|
+
def select_keys(records:, keys_tokens:)
|
24
23
|
records.map do |base_record|
|
25
24
|
new_record = {}
|
26
|
-
|
27
|
-
value =
|
25
|
+
keys_tokens.each do |key, tokens|
|
26
|
+
value = base_record.dig(*tokens)
|
28
27
|
next unless value.present?
|
29
28
|
|
30
29
|
add_value_to_record(record: new_record, key: key, value: value)
|
data/lib/dataflow/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dataflow-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eurico Doirado
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|