|
14 | 14 |
|
15 | 15 | use std::sync::Arc; |
16 | 16 |
|
17 | | -use databend_common_sql::plans::RefreshSelection; |
18 | 17 | use databend_common_storage::read_parquet_schema_async_rs; |
19 | 18 | use databend_common_storages_fuse::FUSE_TBL_VIRTUAL_BLOCK_PREFIX; |
20 | 19 | use databend_common_storages_fuse::FUSE_TBL_VIRTUAL_BLOCK_PREFIX_V1; |
@@ -196,115 +195,6 @@ async fn test_fuse_do_refresh_virtual_column() -> anyhow::Result<()> { |
196 | 195 | Ok(()) |
197 | 196 | } |
198 | 197 |
|
199 | | -#[tokio::test(flavor = "multi_thread")] |
200 | | -async fn test_refresh_virtual_column_block_selection_refreshes_owning_segment() -> anyhow::Result<()> |
201 | | -{ |
202 | | - let fixture = TestFixture::setup().await?; |
203 | | - fixture.create_default_database().await?; |
204 | | - fixture.create_variant_table().await?; |
205 | | - fixture |
206 | | - .execute_command(&format!( |
207 | | - "alter table {}.{} set options(block_per_segment = 100)", |
208 | | - fixture.default_db_name(), |
209 | | - fixture.default_table_name() |
210 | | - )) |
211 | | - .await?; |
212 | | - fixture |
213 | | - .execute_command(&format!( |
214 | | - "alter table {}.{} set options(enable_virtual_column = false)", |
215 | | - fixture.default_db_name(), |
216 | | - fixture.default_table_name() |
217 | | - )) |
218 | | - .await?; |
219 | | - append_variant_sample_data(2, &fixture).await?; |
220 | | - fixture |
221 | | - .execute_command(&format!( |
222 | | - "alter table {}.{} set options(enable_virtual_column = true)", |
223 | | - fixture.default_db_name(), |
224 | | - fixture.default_table_name() |
225 | | - )) |
226 | | - .await?; |
227 | | - |
228 | | - let ctx = fixture.new_query_ctx().await?; |
229 | | - let table = fixture.latest_default_table().await?; |
230 | | - let fuse = FuseTable::try_from_table(table.as_ref())?; |
231 | | - let snapshot = fuse.read_table_snapshot().await?.unwrap(); |
232 | | - let reader = MetaReaders::segment_info_reader(fuse.get_operator(), table.schema()); |
233 | | - let (segment_location, version) = &snapshot.segments[0]; |
234 | | - let segment = reader |
235 | | - .read(&LoadParams { |
236 | | - location: segment_location.clone(), |
237 | | - len_hint: None, |
238 | | - ver: *version, |
239 | | - put_cache: false, |
240 | | - }) |
241 | | - .await?; |
242 | | - let blocks = segment.block_metas()?; |
243 | | - assert!(blocks.len() > 1); |
244 | | - let selected_block = blocks[0].location.0.clone(); |
245 | | - |
246 | | - let results = prepare_refresh_virtual_column( |
247 | | - ctx, |
248 | | - fuse, |
249 | | - None, |
250 | | - true, |
251 | | - Some(RefreshSelection::BlockLocation(selected_block)), |
252 | | - ) |
253 | | - .await?; |
254 | | - assert_eq!(results.len(), blocks.len()); |
255 | | - Ok(()) |
256 | | -} |
257 | | - |
258 | | -#[tokio::test(flavor = "multi_thread")] |
259 | | -async fn test_refresh_virtual_column_limit_keeps_segment_whole() -> anyhow::Result<()> { |
260 | | - let fixture = TestFixture::setup().await?; |
261 | | - fixture.create_default_database().await?; |
262 | | - fixture.create_variant_table().await?; |
263 | | - fixture |
264 | | - .execute_command(&format!( |
265 | | - "alter table {}.{} set options(block_per_segment = 100)", |
266 | | - fixture.default_db_name(), |
267 | | - fixture.default_table_name() |
268 | | - )) |
269 | | - .await?; |
270 | | - fixture |
271 | | - .execute_command(&format!( |
272 | | - "alter table {}.{} set options(enable_virtual_column = false)", |
273 | | - fixture.default_db_name(), |
274 | | - fixture.default_table_name() |
275 | | - )) |
276 | | - .await?; |
277 | | - append_variant_sample_data(2, &fixture).await?; |
278 | | - fixture |
279 | | - .execute_command(&format!( |
280 | | - "alter table {}.{} set options(enable_virtual_column = true)", |
281 | | - fixture.default_db_name(), |
282 | | - fixture.default_table_name() |
283 | | - )) |
284 | | - .await?; |
285 | | - |
286 | | - let ctx = fixture.new_query_ctx().await?; |
287 | | - let table = fixture.latest_default_table().await?; |
288 | | - let fuse = FuseTable::try_from_table(table.as_ref())?; |
289 | | - let snapshot = fuse.read_table_snapshot().await?.unwrap(); |
290 | | - let reader = MetaReaders::segment_info_reader(fuse.get_operator(), table.schema()); |
291 | | - let (segment_location, version) = &snapshot.segments[0]; |
292 | | - let segment = reader |
293 | | - .read(&LoadParams { |
294 | | - location: segment_location.clone(), |
295 | | - len_hint: None, |
296 | | - ver: *version, |
297 | | - put_cache: false, |
298 | | - }) |
299 | | - .await?; |
300 | | - let segment_block_count = segment.block_metas()?.len(); |
301 | | - assert!(segment_block_count > 1); |
302 | | - |
303 | | - let results = prepare_refresh_virtual_column(ctx, fuse, Some(1), true, None).await?; |
304 | | - assert_eq!(results.len(), segment_block_count); |
305 | | - Ok(()) |
306 | | -} |
307 | | - |
308 | 198 | // Inject a legacy _vb/ directory with a file. Vacuum prepare should not remove |
309 | 199 | // files before the commit/cleanup phase runs. |
310 | 200 | #[tokio::test(flavor = "multi_thread")] |
|
0 commit comments