Skip to content

product

relationalai.semantics.std.aggregates
product(*args: AggValue) -> Aggregate

Compute the product of numeric values using the exp-log trick.

Handles negative inputs by taking abs before log-summing and tracking the sign via the parity of the negative-value count. Note: zero inputs yield a NaN result row (ln(0) is not finite); in grouped queries the NaN is contained to its own group and does not affect other groups. Results are floating-point approximations — integer inputs are cast to Float before aggregation.

Parameters

  • *args

    (AggValue, default: ()) - Values to multiply together.

Returns

  • Aggregate - An Aggregate representing the product. Always returns Float.

Examples

Compute product of all quantities:

select(aggregates.product(Item.quantity))

Compute product per category:

select(Category, aggregates.product(Item.quantity).per(Category))