Annotating AggregateFunction accumulator type with @DataTypeHint

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Annotating AggregateFunction accumulator type with @DataTypeHint

Yuval Itzchakov
Hi, I have an aggregate function of the form:

class Foo extends AggregateFunction[Array[Json], util.List[Json]]

I want to treat the accumulator as a "RAW" type, since Json is an abstract class and this fails at runtime.

Is there any way to annotate the AggregateFunction accumulator type? All the examples in the docs refer to Scalar functions.
--
Best Regards,
Yuval Itzchakov.
Reply | Threaded
Open this post in threaded view
|

Re: Annotating AggregateFunction accumulator type with @DataTypeHint

Seth Wiesman
Yes, the FunctionHint annotation has an accumulator field. There is an example in its JavaDoc.

Seth

On Tue, Jan 26, 2021 at 6:39 AM Yuval Itzchakov <[hidden email]> wrote:
Hi, I have an aggregate function of the form:

class Foo extends AggregateFunction[Array[Json], util.List[Json]]

I want to treat the accumulator as a "RAW" type, since Json is an abstract class and this fails at runtime.

Is there any way to annotate the AggregateFunction accumulator type? All the examples in the docs refer to Scalar functions.
--
Best Regards,
Yuval Itzchakov.