Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions 6 bigframes/core/compile/polars/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,11 @@ def compile_agg_op(
if isinstance(op, agg_ops.StdOp):
return pl.std(inputs[0])
if isinstance(op, agg_ops.VarOp):
return pl.var(inputs[0])
# polars var doesnt' support decimal, so use std instead
return pl.std(inputs[0]).pow(2)
if isinstance(op, agg_ops.PopVarOp):
return pl.var(inputs[0], ddof=0)
# polars var doesnt' support decimal, so use std instead
return pl.std(inputs[0], ddof=0).pow(2)
if isinstance(op, agg_ops.FirstNonNullOp):
return pl.col(*inputs).drop_nulls().first()
if isinstance(op, agg_ops.LastNonNullOp):
Expand Down
3 changes: 3 additions & 0 deletions 3 bigframes/session/polars_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
agg_ops.SumOp,
agg_ops.MeanOp,
agg_ops.CountOp,
agg_ops.VarOp,
agg_ops.PopVarOp,
agg_ops.StdOp,
)


Expand Down
14 changes: 14 additions & 0 deletions 14 tests/system/small/engines/test_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ def test_engines_unary_aggregates(
assert_equivalence_execution(node, REFERENCE_ENGINE, engine)


@pytest.mark.parametrize("engine", ["polars", "bq"], indirect=True)
@pytest.mark.parametrize(
"op",
[agg_ops.std_op, agg_ops.var_op, agg_ops.PopVarOp()],
)
def test_engines_unary_variance_aggregates(
scalars_array_value: array_value.ArrayValue,
engine,
op,
):
node = apply_agg_to_all_valid(scalars_array_value, op).node
assert_equivalence_execution(node, REFERENCE_ENGINE, engine)


def test_sql_engines_median_op_aggregates(
scalars_array_value: array_value.ArrayValue,
bigquery_client: bigquery.Client,
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.