unytics / bigfunctions

Supercharge BigQuery with BigFunctions
https://unytics.io/bigfunctions/
MIT License
583 stars 54 forks source link

[new]: `udaf` compatibility - `weighted_average`(element, weight) #138

Closed AxelThevenot closed 4 months ago

AxelThevenot commented 4 months ago

Check the idea has not already been suggested

Edit the title above with self-explanatory function name and argument names

BigFunction Description as it would appear in the documentation

with
   _sample_data as (
      select 10 as grade, 1 as ponderation
      union all 
      select 13 as grade, 2 as ponderation
  )
select 
  `sandbox-athevenot`.`wrk_dataset`.weighted_average(grade, ponderation) as final_grade 
from `_sample_data`

Examples of (arguments, expected output) as they would appear in the documentation

example above returns 12.0