()
| 101 | // This test is equivalent with the test parallel_query_with_filter below but using prepare statement |
| 102 | #[tokio::test] |
| 103 | async fn test_prepare_statement() -> Result<()> { |
| 104 | let tmp_dir = TempDir::new()?; |
| 105 | let partition_count = 4; |
| 106 | let ctx = create_ctx_with_partition(&tmp_dir, partition_count).await?; |
| 107 | |
| 108 | // sql to statement then to prepare logical plan with parameters |
| 109 | let dataframe = ctx |
| 110 | .sql("SELECT c1, c2 FROM test WHERE c1 > $2 AND c1 < $1") |
| 111 | .await?; |
| 112 | |
| 113 | // prepare logical plan to logical plan without parameters |
| 114 | let param_values = vec![ScalarValue::Int32(Some(3)), ScalarValue::Float64(Some(0.0))]; |
| 115 | let dataframe = dataframe.with_param_values(param_values)?; |
| 116 | let results = dataframe.collect().await?; |
| 117 | |
| 118 | assert_snapshot!(batches_to_sort_string(&results), @r" |
| 119 | +----+----+ |
| 120 | | c1 | c2 | |
| 121 | +----+----+ |
| 122 | | 1 | 1 | |
| 123 | | 1 | 10 | |
| 124 | | 1 | 2 | |
| 125 | | 1 | 3 | |
| 126 | | 1 | 4 | |
| 127 | | 1 | 5 | |
| 128 | | 1 | 6 | |
| 129 | | 1 | 7 | |
| 130 | | 1 | 8 | |
| 131 | | 1 | 9 | |
| 132 | | 2 | 1 | |
| 133 | | 2 | 10 | |
| 134 | | 2 | 2 | |
| 135 | | 2 | 3 | |
| 136 | | 2 | 4 | |
| 137 | | 2 | 5 | |
| 138 | | 2 | 6 | |
| 139 | | 2 | 7 | |
| 140 | | 2 | 8 | |
| 141 | | 2 | 9 | |
| 142 | +----+----+ |
| 143 | "); |
| 144 | |
| 145 | Ok(()) |
| 146 | } |
| 147 | |
| 148 | #[tokio::test] |
| 149 | async fn prepared_statement_type_coercion() -> Result<()> { |
nothing calls this directly
no test coverage detected
searching dependent graphs…