【问题标题】:whether impala support java UDF in where clauseimpala 在 where 子句中是否支持 java UDF
【发布时间】:2019-07-01 14:24:36
【问题描述】:

我可以在 hive 和 impala 中使用基于 java 的 UDF,但是在 where 子句中调用 udf 时会抛出 ClassNotFound 错误

UDF 在 where 子句中引用时无法使用,但在 impala 2.9.0-cdh5.12.1 仅在 select 后面引用时正常工作

在 hive 中 select udfjson(memo,state) from tableA where udfjson(memo,state) = 0 and name = 'test' 工作正常,但在 impala 中没有。

在 impala 中执行 select udfjson(memo,state) from tableA where name = 'test' 就可以了。 UDF 只能在 impala 中使用,不能在 where 子句中使用

这是错误

Error(255): Unknown error 255
Root cause: NoClassDefFoundError: org/apache/hadoop/hdfs/DFSInputStream$ByteArrayStrategy

可以在 where 子句中用 impala 引用 UDF 吗?

【问题讨论】:

    标签: user-defined-functions impala


    【解决方案1】:

    使用子查询:

    select * from
    (
    select udfjson(memo,state) as state from tableA where name = 'test'
    )s
    where s.state=0
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-03
      • 2013-02-03
      • 2022-01-11
      • 1970-01-01
      • 2020-05-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多