shell - 将 hdfs 上的脚本文件传递给 impala-shell

标签 shell hadoop hdfs oozie impala

我有一个 oozie 作业,它有一个 shell 操作。 首先,shell 操作以编程方式查找存储在 hdfs 上的某些 sql 脚本文件。 然后尝试在 impala 上运行每个 sql 脚本。

由于事先不知道我要运行的 sql 脚本列表,因此不能作为 <file> 传递给 oozie 操作参数,有没有办法运行 impala-shell 并给它一个 hdfs 路径而不是 linux 路径?

最佳答案

Impala shell 可以接受来自 STDIN 的查询文本。如所述here , 选项 -f

-f query_file or --query_file=query_file

query_file=path_to_query_file

Passes a SQL query from a file. Multiple statements must be semicolon (;) delimited. In Impala 2.3 and higher, you can specify a filename of - to represent standard input. This feature makes it convenient to use impala-shell as part of a Unix pipeline where SQL statements are generated dynamically by other tools.

所以在你的情况下,你的 shell 脚本可以简单地做一些像

$ hdfs dfs -cat <hdfs_file_name> | impala-shell -i <impala_daemon> -f -

关于shell - 将 hdfs 上的脚本文件传递给 impala-shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57374651/

相关文章:

bash - 如何将多个命令通过管道传输到 shell 中的单个命令? (嘘,庆典,...)

python - 在后台启动程序,并在其中一个程序因退出代码而死亡时立即将其杀死

azure - 从 Azure HDInsight 迁移到 Amazon EMR?

linux - bash 上的 GAMESS 配置脚本错误 : syntax error near $<

hadoop - 如何在 Spark on YARN 中为 Spark UI 创建安全过滤器

javascript - 通过 node.js 和 hdfs 模块将文件上传到 HDFS

hadoop - MapReduce-生成HDFS路径

mysql - 通过 Sqoop 将带有自定义分隔符的 HDFS 文件导出到 Mysql

scala - 使用spark访问HDFS失败

linux - Github - 旧帐户的权限被拒绝