字符串连接运算符(||)在配置单元中抛出错误

string concat operator(||) throwing error in hive

我正在尝试使用连接运算符 || 连接 table 中的字符串列并抛出错误。

Here is the query: select "Bob"||'~'||"glad" from table

its throwing error as : ParseException - cannpt recognize input near '|' '"~"' '|' in expression specification

它适用于 concat 函数,但不适用于 concat 运算符。

select concat("bob","~","glad") from table - its working

我使用的是 Hive 版本 2.1,谁能告诉我为什么这个运算符不起作用?

谢谢巴布

Hive 不支持连接运算符 ||,它的 oracle 语法。请使用 concat 函数来连接多个值。您可以使用 concat_ws 与定界符连接。
连接

select concat ('this','~','is','~','hello','~','world');
Output : this~is~hello~world
select concat_ws ('~','hello','world','is','not','enough');
Output : hello~world~is~not~enough