pola-rs/polars · error

activate 'round_series' feature

Error message

activate 'round_series' feature

What it means

apply_operator in binary expression evaluation handles arithmetic operators including round-related ones (e.g. Operator::Modulus-style paths gated on `round_series` depending on version). With the `round_series` feature disabled, the corresponding operator branch panics. It means an operator in an expression (left OP right) requires a compile-time feature the build lacks.

Solutions

  1. Enable `round_series` in the polars features in Cargo.toml
  2. Rewrite the expression to avoid the gated operator (e.g. implement modulo/rounding via supported arithmetic or a map/apply)
  3. Check which operator triggers it by logging Operator before apply_operator
  4. Align feature sets between client and server if expressions cross a boundary (e.g. polars-lazy deserialization)

Example fix

// before
polars = { version = "0.46", default-features = false, features = ["lazy"] }
// after
polars = { version = "0.46", default-features = false, features = ["lazy", "round_series"] }
Defensive patterns

Strategy: try-catch

Validate before calling

fn uses_gated_operator(op: Operator) -> bool {
    // round_series-gated operators (e.g. modulo/round-family in this build)
    matches!(op, Operator::Modulus) // extend to the actual gated set
}
if uses_gated_operator(op) { /* require round_series or rewrite expression */ }

Try / catch

match std::panic::catch_unwind(|| apply_operator(op, &l, &r)) {
    Ok(res) => res,
    Err(_) => return Err("operator requires 'round_series' feature".into()),
}

Prevention

When it happens

Trigger: Evaluating a binary expression whose Operator maps to the round_series-gated branch (e.g. floor-mod / round-style operations) via apply_operator, reached from apply_operator_owned, apply_elementwise, apply_all_literal, etc., without the `round_series` feature.

Common situations: Minimal default-features-off polars builds; expressions deserialized/parsed from another process (e.g. a Python client) whose operators assume features enabled server-side; copying query code that uses % or round-adjacent operators.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/4ad84ecbb115afd9. Report an issue: GitHub.

Appendix: source

Thrown at crates/polars-expr/src/expressions/binary.rs:171

            _ => {
                if right.dtype().is_temporal() {
                    return left / right;
                }
                left.cast(&Float64)? / right.cast(&Float64)?
            },
        },
        Operator::FloorDivide => {
            #[cfg(feature = "round_series")]
            {
                floor_div_series(
                    left.as_materialized_series(),
                    right.as_materialized_series(),
                )
                .map(Column::from)
            }
            #[cfg(not(feature = "round_series"))]
            {
                panic!("activate 'round_series' feature")
            }
        },
        Operator::And => left.bitand(right),
        Operator::Or => left.bitor(right),
        Operator::LogicalOr => left
            .cast(&DataType::Boolean)?
            .bitor(&right.cast(&DataType::Boolean)?),
        Operator::LogicalAnd => left
            .cast(&DataType::Boolean)?
            .bitand(&right.cast(&DataType::Boolean)?),
        Operator::Xor => left.bitxor(right),
        Operator::Modulus => left % right,
        Operator::EqValidity => left.equal_missing(right).map(|ca| ca.into_column()),
        Operator::NotEqValidity => left.not_equal_missing(right).map(|ca| ca.into_column()),
    }
}

impl BinaryExpr {

View on GitHub (pinned to fe841f959e)