MCPcopy Create free account
hub / github.com/apache/datafusion / test_i32_result

Function test_i32_result

datafusion/functions-window/src/nth_value.rs:553–576  ·  view source on GitHub ↗
(
        expr: NthValue,
        partition_evaluator_args: PartitionEvaluatorArgs,
        expected: Int32Array,
    )

Source from the content-addressed store, hash-verified

551 use datafusion_physical_expr::expressions::{Column, Literal};
552
553 fn test_i32_result(
554 expr: NthValue,
555 partition_evaluator_args: PartitionEvaluatorArgs,
556 expected: Int32Array,
557 ) -> Result<()> {
558 let arr: ArrayRef = Arc::new(Int32Array::from(vec![1, -2, 3, -4, 5, -6, 7, 8]));
559 let values = vec![arr];
560 let mut ranges: Vec<Range<usize>> = vec![];
561 for i in 0..8 {
562 ranges.push(Range {
563 start: 0,
564 end: i + 1,
565 })
566 }
567 let mut evaluator = expr.partition_evaluator(partition_evaluator_args)?;
568 let result = ranges
569 .iter()
570 .map(|range| evaluator.evaluate(&values, range))
571 .collect::<Result<Vec<ScalarValue>>>()?;
572 let result = ScalarValue::iter_to_array(result)?;
573 let result = as_int32_array(&result)?;
574 assert_eq!(expected, *result);
575 Ok(())
576 }
577
578 #[test]
579 fn first_value() -> Result<()> {

Callers 4

first_valueFunction · 0.70
last_valueFunction · 0.70
nth_value_1Function · 0.70
nth_value_2Function · 0.70

Calls 7

newFunction · 0.85
as_int32_arrayFunction · 0.85
pushMethod · 0.45
partition_evaluatorMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…