()
| 54 | |
| 55 | #[tokio::test] |
| 56 | async fn test_named_query_parameters() -> Result<()> { |
| 57 | let tmp_dir = TempDir::new()?; |
| 58 | let partition_count = 4; |
| 59 | let ctx = create_ctx_with_partition(&tmp_dir, partition_count).await?; |
| 60 | |
| 61 | // sql to statement then to logical plan with parameters |
| 62 | let results = ctx |
| 63 | .sql("SELECT c1, c2 FROM test WHERE c1 > $coo AND c1 < $foo") |
| 64 | .await? |
| 65 | .with_param_values(vec![ |
| 66 | ("foo", ScalarValue::UInt32(Some(3))), |
| 67 | ("coo", ScalarValue::UInt32(Some(0))), |
| 68 | ])? |
| 69 | .collect() |
| 70 | .await?; |
| 71 | assert_snapshot!(batches_to_sort_string(&results), @r" |
| 72 | +----+----+ |
| 73 | | c1 | c2 | |
| 74 | +----+----+ |
| 75 | | 1 | 1 | |
| 76 | | 1 | 10 | |
| 77 | | 1 | 2 | |
| 78 | | 1 | 3 | |
| 79 | | 1 | 4 | |
| 80 | | 1 | 5 | |
| 81 | | 1 | 6 | |
| 82 | | 1 | 7 | |
| 83 | | 1 | 8 | |
| 84 | | 1 | 9 | |
| 85 | | 2 | 1 | |
| 86 | | 2 | 10 | |
| 87 | | 2 | 2 | |
| 88 | | 2 | 3 | |
| 89 | | 2 | 4 | |
| 90 | | 2 | 5 | |
| 91 | | 2 | 6 | |
| 92 | | 2 | 7 | |
| 93 | | 2 | 8 | |
| 94 | | 2 | 9 | |
| 95 | +----+----+ |
| 96 | "); |
| 97 | Ok(()) |
| 98 | } |
| 99 | |
| 100 | // Test prepare statement from sql to final result |
| 101 | // This test is equivalent with the test parallel_query_with_filter below but using prepare statement |
nothing calls this directly
no test coverage detected
searching dependent graphs…