Skip to content

Commit 1327a97

Browse files
committed
Fix join on multiple destinations
1 parent 4cfbd40 commit 1327a97

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

datasources/connectors/join.rb

+7-6
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ def setup(kiba)
3131
'metadata' => JSON.parse(File.read("./#{@path}/#{source_config['metadata']}.metadata.json"))[source]
3232
})
3333
)
34-
}
3534

36-
kiba.transform(JoinTransformer, JoinTransformer::Settings.from_hash({
37-
'destination_id' => destination_id,
38-
'key' => key,
39-
'full_join' => true,
40-
}))
35+
kiba.transform(JoinTransformer, JoinTransformer::Settings.from_hash({
36+
'source_ids' => [join.keys],
37+
'destination_id' => destination_id,
38+
'key' => key,
39+
'full_join' => true,
40+
}))
41+
}
4142
}
4243
end
4344
end

datasources/transforms/join.rb

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class JoinTransformer < Transformer
1010
extend T::Sig
1111

1212
class Settings < Transformer::TransformerSettings
13+
const :source_ids, T.nilable(T::Array[String])
1314
const :destination_id, String
1415
const :key, String
1516
const :full_join, T::Boolean, default: false
@@ -51,6 +52,8 @@ def process_tags(current_tags, update_tags, current_source, update_source)
5152
end
5253

5354
def process_data(row)
55+
return row if @settings.destination_id != row[:destination_id]
56+
5457
key = JsonPath.on(row[:properties][:tags], @path)
5558
if key.present?
5659
if @rows.key?(key)

0 commit comments

Comments
 (0)