【问题标题】:Hive - LIKE operator with special charactersHive - 带有特殊字符的 LIKE 运算符
【发布时间】:2018-06-10 20:51:37
【问题描述】:

我是 hive 的新手,我试图提取表中匹配特定格式的所有记录。

> Table structure-
>     (
>     id string,
>     col_json string
>     )

在 json col_json 中,有一个属性是我在其中寻找格式的文本

  • \"abc\":\"xyz\"

.

我正在使用如下的 where 条件 - 和 get_json_object(a.col_json,'$.Attributes[].attributeValues[].attributeValue') 像 '%\"abc\":\"xyz\"%'

但这似乎不起作用,因为我没有返回任何行。 有人可以提出问题所在吗?

【问题讨论】:

    标签: hive hiveql


    【解决方案1】:

    在类似函数的每个反斜杠之前再添加一个反斜杠并再次运行

    蜂巢> get_json_object(a.col_json,'$.Attributes[].attributeValues[].attributeValue') 比如'%\\"abc\\":\\"xyz\\"%'

    一个反斜杠配置单元认为它被用作转义字符(),所以我们需要使用两个反斜杠(\)然后 hive 认为是 ****

    【讨论】:

      猜你喜欢
      • 2014-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-05
      • 2021-07-02
      • 1970-01-01
      • 2013-11-02
      相关资源
      最近更新 更多