apache-spark - 字符串连接运算符(||)在配置单元中抛出错误
问题描述
我正在尝试使用 concat 运算符 || 连接表中的字符串列 并抛出错误。
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 不支持 concat 运算符||
,它的 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
推荐阅读
- python - 错误:没有名为“register.forms”的模块,使用crispy-forms django
- javascript - 获取嵌套对象内项目的绝对键
- discord.js - 如何让你的机器人在 discord 上发送多个直接嵌入的消息
- bash - 在 bash 中显示两个 grep 命令的结果
- xamarin - 在 chromeos 上关闭 android 应用程序时保存状态
- javascript - 有没有办法在 mongoDB 中将 $regex 与 $all 一起使用?
- javascript - 如何检查reactjs映射中的未定义
- java - 我在java中的while循环不起作用,只能完成一次
- javascript - 我使用 CSS 的“分页符”不适用于我在 React 中使用 .html() 的 jsPDF
- amazon-web-services - 带有 s3 同步的 aws cli 问题没有从子文件夹复制文件