influxdata/influxdb · error

expected Float64Array

Error message

expected Float64Array

What it means

A test panic in derivative.rs (`evaluate_identical_times_returns_infinity`). After the derivative evaluator's `evaluate_all` returns a RecordBatch/ArrayVector, the test downcasts the result array to Float64Array via `expect("expected Float64Array")`. The panic means the evaluator returned a different physical array type than Float64 for the derivative column.

Solutions

  1. Reproduce with `cargo test -p query_functions evaluate_identical_times_returns_infinity`.
  2. Log result.data_type() before the downcast to see the actual returned type.
  3. Fix the evaluator so derivatives are always emitted as Float64Array, or update the test downcast to the new type.

Example fix

// before
.expect("expected Float64Array");
// after
.expect("expected Float64Array")
// or defensively:
let Some(result) = result.as_any().downcast_ref::<Float64Array>() else {
    panic!("expected Float64Array, got {:?}", result.data_type());
};
Defensive patterns

Strategy: type-guard

Validate before calling

assert_eq!(result.data_type(), DataType::Float64, "derivative output must be Float64");

Type guard

fn as_f64(arr: &dyn Array) -> Option<&Float64Array> {
    arr.as_any().downcast_ref::<Float64Array>()
}

Try / catch

let Some(result) = result.as_any().downcast_ref::<Float64Array>() else {
    panic!("expected Float64Array, got {:?}", result.data_type());
};

Prevention

When it happens

Trigger: Calling evaluate_all with value/time arrays (Float64 values, TimestampNanosecond times with duplicate timestamps) and downcasting the output to Float64Array — the panic fires when the result is another type (e.g. Float32, or wrapped differently after a refactor).

Common situations: Developers changing the derivative implementation's output type, or altering how evaluate_all packages results, hit this in unit tests. Also occurs if a test helper change swaps value column types.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/2aff369eca2bbfb1. Report an issue: GitHub.

Appendix: source

Thrown at core/query_functions/src/derivative.rs:436

    #[test]
    fn evaluate_identical_times_returns_infinity() {
        use arrow::array::{Float64Array, TimestampNanosecondArray};

        let udwf = DerivativeUDWF::new();
        let (exprs, fields) = evaluator_args(None);
        let args = PartitionEvaluatorArgs::new(&exprs, &fields, false, false);
        let mut evaluator = udwf.partition_evaluator(args).unwrap();

        let values: Vec<ArrayRef> = vec![
            Arc::new(Float64Array::from(vec![1.0, 2.0, 3.0])),
            Arc::new(TimestampNanosecondArray::from(vec![100, 100, 100])),
        ];
        let result = evaluator.evaluate_all(&values, 3).unwrap();
        let result = result
            .as_any()
            .downcast_ref::<Float64Array>()
            .expect("expected Float64Array");

        assert!(result.is_null(0)); // first row is always null
        assert_eq!(result.value(1), f64::INFINITY); // dt == 0, dv > 0 => +inf
        assert_eq!(result.value(2), f64::INFINITY); // dt == 0, dv > 0 => +inf
    }

    #[test]
    fn evaluate_identical_times_zero_delta_returns_nan() {
        use arrow::array::{Float64Array, TimestampNanosecondArray};

        let udwf = DerivativeUDWF::new();
        let (exprs, fields) = evaluator_args(None);
        let args = PartitionEvaluatorArgs::new(&exprs, &fields, false, false);
        let mut evaluator = udwf.partition_evaluator(args).unwrap();

        let values: Vec<ArrayRef> = vec![
            Arc::new(Float64Array::from(vec![5.0, 5.0])),
            Arc::new(TimestampNanosecondArray::from(vec![100, 100])),

View on GitHub (pinned to 06200ef96b)