选择列输出到一个字符串中。蜂巢
selecting column output into a string. Hive
我正在寻找一种在配置单元中自定义输出的方法。
例如我的查询是。
select col1,col2 from table1
我希望将 col1
和 col2
插入预定义的字符串中,例如。
"Hey there, value1 is <col1>
and value2 is <col2>
"
如果可能,所有这些都将进入本地文件系统上的输出文件。请建议一种方法。
试试这个:
hive -e 'select concat('Hey there value1 is ', col1, ' and value2 is ', col2, '.') as my_string from my_table' > /path/localfilesystem/filename.txt
我正在寻找一种在配置单元中自定义输出的方法。
例如我的查询是。
select col1,col2 from table1
我希望将 col1
和 col2
插入预定义的字符串中,例如。
"Hey there, value1 is <col1>
and value2 is <col2>
"
如果可能,所有这些都将进入本地文件系统上的输出文件。请建议一种方法。
试试这个:
hive -e 'select concat('Hey there value1 is ', col1, ' and value2 is ', col2, '.') as my_string from my_table' > /path/localfilesystem/filename.txt