Skip to main content
The weighted_sum UDAF takes a weight, type, and type-weight mapping to produce an aggregated weight. For example, consider the following SQL snippet: import from ‘/snippets/LwTemplate.jsx’;
When applied to the rows in the table below, the weighted_sum function produces a final weight_d of 12.0 (21.0 + 110.0). The UDAF is passed rows grouped by query, doc_id, and filters.