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. Zero inputs yield 0.0 (exp(-inf) = 0.0 by IEEE 754); in grouped queries zeros are contained to their own group and do not affect other groups. Results are floating-point approximations — integer inputs are cast to Float before aggregation.

  • *args

    (AggValue, default: ()) - Values to multiply together.
  • Aggregate - An Aggregate representing the product. Always returns Float.

Compute product of all quantities:

select(aggregates.product(Item.quantity))

Compute product per category:

select(Category, aggregates.product(Item.quantity).per(Category))
RelationalAI Documentation
└──  Release Notes
    └──  Python API Release Notes
        └──  What’s New in Version 1.12.0
            └──  New Features and Enhancements