Problem
When a JavaScript / Python / Remote UDA reads from a changelog input (CDC stream, versioned_kv, EMIT CHANGELOG, or downstream of a global aggregation), the engine appends an extra trailing _tp_delta column (+1 for insert, -1 for retract) to the arguments passed to the UDA's process(...). The UDA must use this delta to add or subtract from its accumulated state.
This contract is implemented in the engine — e.g. AggregateFunctionJavaScriptAdapter.h:
"If the input stream is changelog, aggregate function will pass _tp_delta column to JavaScript function"
and AggregateFunctionPythonAdapter.cpp does the same for Python adapters (insert +1 on add, -1 on negate as the trailing column).
But it is not documented anywhere in the UDA pages:
docs/js-udf.md
docs/py-udf.md
docs/remote-udf.md
_tp_delta is documented as a general changelog-stream concept (docs/changelog-stream.md, docs/global-aggregation.md, docs/streaming-aggregations.md), but a user writing a UDA has no way to learn that their process() will receive an extra trailing array when the input is a changelog — leading to silently wrong aggregates on retracts.
Suggested fix
Add a "Changelog input" subsection to each UDA page covering:
- when the extra
_tp_delta argument is appended (changelog inputs only)
- its shape (trailing column, same length as the other argument arrays, values ∈ {+1, -1})
- a small worked example showing add-vs-subtract handling in
process()
- interaction with
has_customized_emit
Problem
When a JavaScript / Python / Remote UDA reads from a changelog input (CDC stream,
versioned_kv,EMIT CHANGELOG, or downstream of a global aggregation), the engine appends an extra trailing_tp_deltacolumn (+1 for insert, -1 for retract) to the arguments passed to the UDA'sprocess(...). The UDA must use this delta to add or subtract from its accumulated state.This contract is implemented in the engine — e.g.
AggregateFunctionJavaScriptAdapter.h:and
AggregateFunctionPythonAdapter.cppdoes the same for Python adapters (insert+1on add,-1on negate as the trailing column).But it is not documented anywhere in the UDA pages:
docs/js-udf.mddocs/py-udf.mddocs/remote-udf.md_tp_deltais documented as a general changelog-stream concept (docs/changelog-stream.md,docs/global-aggregation.md,docs/streaming-aggregations.md), but a user writing a UDA has no way to learn that theirprocess()will receive an extra trailing array when the input is a changelog — leading to silently wrong aggregates on retracts.Suggested fix
Add a "Changelog input" subsection to each UDA page covering:
_tp_deltaargument is appended (changelog inputs only)process()has_customized_emit