简体   繁体   English

在Apache Nifi上运行多个配置单元SQL

[英]Run Multiple hive sql on Apache Nifi

I have a Apache Nifi 1.2 workflow that reads from hdfs process some stuff and writes the information on a history table. 我有一个Apache Nifi 1.2工作流,该工作流从hdfs中读取内容,并在历史记录表中写入信息。 After that I want to run 3 hive querys to create a new table based on the history table. 之后,我想运行3个配置单元查询以基于历史记录表创建一个新表。 Why is it so hard to do it on Nifi ? 为什么在Nifi上如此困难? I did not find any simple way to use the putSQL or SelectHiveQL. 我没有找到使用putSQL或SelectHiveQL的任何简单方法。 I don't want to use ExecuteStreamedCommand because I want to keep to the nifi libs. 我不想使用ExecuteStreamedCommand,因为我想保留nifi库。

Any help on this ? 有什么帮助吗? thanks 谢谢

Use GenerateFlowFile that contains the first hql you want to run. 使用包含要运行的第一个hql的GenerateFlowFile。 Connect it to PutHiveQL which is connected to ReplaceText. 将其连接到PutHiveQL,后者与ReplaceText连接。

In ReplaceText, replace the existing content with 2nd hql and then connect to another PutHiveQL. 在ReplaceText中,用2nd hql替换现有内容,然后连接到另一个PutHiveQL。 and so on.... 等等....

It is very annoying but if you have only 3 hqls then it works. 这很烦人,但是如果您只有3个hqls,则可以使用。

Update: Better way to do this is to use GenerateFlowFile. 更新:更好的方法是使用GenerateFlowFile。 Put your entire script there. 将整个脚本放在那里。 Connect it to SplitContent and split on semicolon (;) and then send it to PutHiveQL. 将其连接到SplitContent并以分号(;)分割,然后将其发送到PutHiveQL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM