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

Function test_basic_split_multi_exprs

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

Source from the content-addressed store, hash-verified

651
652 #[tokio::test]
653 async fn test_basic_split_multi_exprs() {
654 test_helpers::maybe_start_logging();
655 let batch0 = RecordBatch::try_from_iter(vec![
656 (
657 "int_col",
658 Arc::new(Int64Array::from(vec![1, 2, 3])) as ArrayRef,
659 ),
660 (
661 "str_col",
662 Arc::new(StringArray::from(vec!["one", "two", "three"])) as ArrayRef,
663 ),
664 ])
665 .unwrap();
666
667 let batch1 = RecordBatch::try_from_iter(vec![
668 (
669 "int_col",
670 Arc::new(Int64Array::from(vec![4, -2])) as ArrayRef,
671 ),
672 (
673 "str_col",
674 Arc::new(StringArray::from(vec!["four", "negative 2"])) as ArrayRef,
675 ),
676 ])
677 .unwrap();
678
679 let input = make_input(vec![vec![batch0, batch1]]);
680 // int_col < 2
681 let split_expr1 = df_physical_expr(&input, col("int_col").lt(lit::<i16>(2)));
682 // 2 <= int_col < 3
683 let expr = col("int_col")
684 .gt_eq(lit::<i16>(2))
685 .and(col("int_col").lt(lit::<i16>(3)));
686 let split_expr2 = df_physical_expr(&input, expr);
687 let split_exec: Arc<dyn ExecutionPlan> =
688 Arc::new(StreamSplitExec::new(input, vec![split_expr1, split_expr2]));
689
690 let output0 = test_collect_partition(Arc::clone(&split_exec), 0).await;
691 let expected = vec![
692 "+---------+------------+",
693 "| int_col | str_col |",
694 "+---------+------------+",
695 "| -2 | negative 2 |",
696 "| 1 | one |",
697 "+---------+------------+",
698 ];
699 assert_batches_sorted_eq!(&expected, &output0);
700
701 let output1 = test_collect_partition(Arc::clone(&split_exec), 1).await;
702 let expected = vec![
703 "+---------+---------+",
704 "| int_col | str_col |",
705 "+---------+---------+",
706 "| 2 | two |",
707 "+---------+---------+",
708 ];
709 assert_batches_sorted_eq!(&expected, &output1);
710

Callers

nothing calls this directly

Calls 7

maybe_start_loggingFunction · 0.85
make_inputFunction · 0.85
df_physical_exprFunction · 0.85
test_collect_partitionFunction · 0.85
ltMethod · 0.80
andMethod · 0.80
gt_eqMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…