如何基于列值(CSV)在Apache NiFi中连接两个流文件?

huangapple go评论66阅读模式
英文:

How to concate 2 flowfiles in Apache NiFi based on the column value (csv)?

问题

我是新手使用NiFi,目前正在处理一个任务,其中有一个flowfile:

"a","b","c","d"
"abc","jfx","daw","123"
"eqw","poq","djw","456"

还有另一个flowfile:

"d","e","f","g"
"123","VVV","010","dv2"
"412","GGG","188","kw2"

我需要将它们合并成一个单一的flowfile,其中列"d"相同。所以我会得到:

"a","b","c","d","e","f","g"
"abc","jfx","daw","123","VVV","010","dv2"
"eqw","poq","djw","456","","",""

问题是,如果file1在file2中找不到相同的"d"值,我想查看其他file2-s(不是所有的flowfiles都会有相同的值,但它们都会有相同的列)
谢谢

我尝试了MergeContent,但它没有给出正确的结果。我正在尝试使用分叉增强和连接增强,但我做错了什么。

英文:

I am new to NiFi, and I am currently working on a task where I have a flowfile:

"a","b","c","d" <br>
"abc","jfx","daw","123" <br>
"eqw","poq","djw","456" <br>

And another flowfile:

"d","e","f","g" <br>
"123","VVV","010","dv2" <br>
"412","GGG","188","kw2" <br>

I need to merge them into a single flowfile where columns "d" are the same.
So I would get:

"a","b","c","d","e","f","g" <br>
"abc","jfx","daw","123","VVV","010","dv2" <br>
"eqw","poq","djw","456","","","" <br>

The problem is, if the file1 doesn't find the same value od "d" in file2, I would like to look at other file2-s (not all the flowfiles will have the same values, but all of them will have the same columns)
Thanks

I have tried MergeContent but it doesn't spit the right result. I am trying with fork enrichment and join enrichment but I am doing something wrong.

答案1

得分: 1

如果您的FlowFiles中有一个静态的CSV文件,您可以使用LookupRecord与其他配置CSVRecordLookupService来匹配列d。对于更复杂的数据丰富场景,请查看ForkEnrichmentJoinEnrichment处理器。

英文:

If one of your FlowFiles is a static CSV file, you could use LookupRecord with the other and configure the CSVRecordLookupService to match on column d. For more complex enrichment scenarios check out the ForkEnrichment and JoinEnrichment processors.

huangapple
  • 本文由 发表于 2023年7月6日 18:36:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76627937.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定