-
Notifications
You must be signed in to change notification settings - Fork 35
UDF
Jolan Rensen edited this page Jul 29, 2022
·
12 revisions
See the examples in code.
A(BCD)EF
:
-
A
(xor)-
udf
to just create a (vararg) UDF -
udaf
to just create a UDAF -
udafUnnamed
to create an unnamed UDAF (for whenudaf
fails to get a name from the Aggregator) -
udf.register
to immediately create and register a (vararg) UDF or UDAF. RequiresB
or requiresC
to be aNamedUserDefinedFunction
, anAggregator
, or a (vararg) UDF / UDAF function reference.
-
-
B
-
name
. AString
. Optional unless registering an unnamed (vararg) UDF or UDAF. Provides (new) name for the (vararg) UDF or UDAF.
-
-
C
(xor withE
)-
namedUdf
. ANamedUserDefinedFunction
(Vararg
), requiresA
to beudaf.register
(will provide name). -
udf
. AUserDefinedFunction
(Vararg
), requiresA
to beudaf.register
and requiresB
(will provide name). -
func
. A UDF- or UDAF function reference (will provide name based onfunc
). -
varargFunc
. A vararg UDF function reference. RequiresA
to be NOTudf
(will provide name based onvarargFunc
). -
agg
. AnAggregator
(can be created usingaggregatorOf()
) to create a UDAF. RequiresA
to be NOTudf
(will provide name based onagg
). -
zero
,reduce
,merge
,finish
, OptionalbufferEncoder
, OptionaloutputEncoder
. Creates UDAF in place instead of usingagg
(will provide name, "Aggregator" by default).
-
-
D
-
nondeterministic
. A Boolean. Optional, defaults tofalse
. Updates (vararg) UDF or UDAF to non-deterministic. For instance, for randomization.
-
-
E
(xor withC
)-
func
. An in-place UDF lambda (won't provide name, unless specified inB
orF
). -
varargFunc
. An in-place vararg UDF lambda (= takes a single array as parameter) (won't provide name, unless specified inB
orF
).
-
-
F
(Optional, or)-
.register()
. Will register the (vararg) UDF or UDAF. RequiresB
or requiresC
to be aNamedUserDefinedFunction
, anAggregator
, or a (vararg) UDF / UDAF function reference. -
.register(name: String)
. Will register the (vararg) UDF or UDAF with (new) name. -
.withName(name: String)
. Will give the (named) udf the (new) namename
.
-