Hi Pei,

AFAIK, we currently don't support GenericUDF in Hive (IMPALA-7877) or
things like that. One reason is we don't support complex types in UDF's
arguments or return types. Impala UDF can have variable length of arguments
but they should be in the same type, e.g. concat(STRING...)
and concat_ws(STRING, STRING...).

However, while working on adding builtin masking functions for Ranger
(IMPALA-9010), I meet the same requirements as yours. The masking functions
accept a char or -1 as an argument, which requires hundreds of overloads in
current udf framework.

I create IMPALA-9271 for this. Maybe it can be simply supported by defining
the arguments as impala_udf::AnyVal type and adding a field
in impala_udf::AnyVal representing the actual type. Not sure if this breaks
compatibility of existing UDF binaries. Any ideas from other folks?

Thanks,
Quanlong

On Mon, Dec 9, 2019 at 11:01 AM 王佩 <[email protected]> wrote:

> Hi,
> I want to implement to_json function in Impala, similar to brickhouse
> to_json UDF in Hive (
> https://github.com/klout/brickhouse/blob/master/src/main/java/brickhouse/udf/json/ToJsonUDF.java)
> .
>
> But when registering, I found that Impala does not support Hive
> GenericUDF. Is it true?
>
> If I implement Impala to_json UDF in C ++, can I solve the following
> problems:
> Example: select to_json ('uid', uid, 'action', action ... etc.) as json,
> uid, action, delta from test_udf
> 1. The number of parameters in the to_json function is variable. Can it be
> implemented in C ++?
> 2. When the to_json function is processed internally, can I get data types
> such as `uid` fields?
>
> Or, if I want to implement the to_json function in Impala, is there a
> better idea?
>
>
> best,
> Pei Wang
>

Reply via email to