简体   繁体   English

让 Nifi 在 Hive 中使用“更改表”

[英]Getting Nifi to use 'alter table' in Hive

I have Nifi set to pick up files from an SFTP and then drop them into HDFS folders based on the filename.我将 Nifi 设置为从 SFTP 获取文件,然后根据文件名将它们放入 HDFS 文件夹中。 From there, it needs to send the command alter table ${dbname}.${tablename} add partition (year=${year}, date='${date}');从那里,它需要发送命令alter table ${dbname}.${tablename} add partition (year=${year}, date='${date}');

I get that I need to use the "PutHiveQL" processor, but I'm not sure how to feed it the 'alter table' command.我知道我需要使用“PutHiveQL”处理器,但我不确定如何为其提供“alter table”命令。 I've read some threads over at Hortonworks saying to use the "ReplaceText" processor, but I'm not sure if that would work in this situation.我在 Hortonworks 上读过一些帖子说要使用“ReplaceText”处理器,但我不确定这在这种情况下是否有效。 All of my previous processors are just there to create variables that build the HDFS folder path.我以前的所有处理器都只是为了创建构建 HDFS 文件夹路径的变量。 There's no real "text" to replace.没有真正的“文本”可以替换。 So, any ideas how I can pass on this command to Hive?那么,有什么想法可以将此命令传递给 Hive 吗? Any assistance would be appreciated.任何援助将不胜感激。

Use ReplaceText processor with Always Replace strategy.ReplaceText处理器与Always Replace策略一起使用。

Add these processors at the end of your flow:

--other processors 

PutHDFS //store file into HDFS

ReplaceText //always replace and replacement value alter statement

PutHiveQL //configure HiveConnectionPool and processor executes hive statements.

Now we are creating alter statement using ReplaceText processor and feeding success relation to PutHiveQL processor现在我们正在使用ReplaceText处理器创建 alter 语句并将成功关系提供给PutHiveQL处理器

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

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