运行os命令并将其放置到配置单元变量 [英] run os command and set out put to hive variable

查看:141
本文介绍了运行os命令并将其放置到配置单元变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Hive CLI 中运行此类功能?

Is it possible to run something like this in Hive CLI?

我试图将文件内容作为变量传递给另一个查询。

I am trying to pass file contents as a variable to another query.

set column_list=!cat /home/user/filename.lst ;
create table tabname as select $column_list from ...


推荐答案

file filename.lst

file filename.lst

line

生成一个文件test.sh,

make a file test.sh,

temp=$(cat /home/user/filename.lst)

hive -f test.hql -hiveconf var=$temp

创建另一个文件test.hql

make a another file test.hql

create table test(${hiveconf:var} string);

在终端上

on terminal

sh -x test.sh

它会将行传递给test.hql它会创建一个以行为列的表;

It will pass the line to the test.hql and it will create a table with line as column;

note-所有文件都应该位于同一目录中。此脚本只传递一个变量。

note- all files should be in same directory .This script is passing only one variable.

这篇关于运行os命令并将其放置到配置单元变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆