MCPcopy Create free account
hub / github.com/influxdata/influxdb / test_basic_split

Function test_basic_split

core/iox_query/src/exec/split.rs:596–650  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

594
595 #[tokio::test]
596 async fn test_basic_split() {
597 test_helpers::maybe_start_logging();
598 let batch0 = RecordBatch::try_from_iter(vec![
599 (
600 "int_col",
601 Arc::new(Int64Array::from(vec![1, 2, 3])) as ArrayRef,
602 ),
603 (
604 "str_col",
605 Arc::new(StringArray::from(vec!["one", "two", "three"])) as ArrayRef,
606 ),
607 ])
608 .unwrap();
609
610 let batch1 = RecordBatch::try_from_iter(vec![
611 (
612 "int_col",
613 Arc::new(Int64Array::from(vec![4, -2])) as ArrayRef,
614 ),
615 (
616 "str_col",
617 Arc::new(StringArray::from(vec!["four", "negative 2"])) as ArrayRef,
618 ),
619 ])
620 .unwrap();
621
622 let input = make_input(vec![vec![batch0, batch1]]);
623 // int_col < 3
624 let split_expr = df_physical_expr(&input, col("int_col").lt(lit(3)));
625 let split_exec: Arc<dyn ExecutionPlan> =
626 Arc::new(StreamSplitExec::new(input, vec![split_expr]));
627
628 let output0 = test_collect_partition(Arc::clone(&split_exec), 0).await;
629 let expected = vec![
630 "+---------+------------+",
631 "| int_col | str_col |",
632 "+---------+------------+",
633 "| -2 | negative 2 |",
634 "| 1 | one |",
635 "| 2 | two |",
636 "+---------+------------+",
637 ];
638 assert_batches_sorted_eq!(&expected, &output0);
639
640 let output1 = test_collect_partition(split_exec, 1).await;
641 let expected = vec![
642 "+---------+---------+",
643 "| int_col | str_col |",
644 "+---------+---------+",
645 "| 3 | three |",
646 "| 4 | four |",
647 "+---------+---------+",
648 ];
649 assert_batches_sorted_eq!(&expected, &output1);
650 }
651
652 #[tokio::test]
653 async fn test_basic_split_multi_exprs() {

Callers

nothing calls this directly

Calls 6

maybe_start_loggingFunction · 0.85
make_inputFunction · 0.85
df_physical_exprFunction · 0.85
litFunction · 0.85
test_collect_partitionFunction · 0.85
ltMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…