databendlabs / databend

๐——๐—ฎ๐˜๐—ฎ, ๐—”๐—ป๐—ฎ๐—น๐˜†๐˜๐—ถ๐—ฐ๐˜€ & ๐—”๐—œ. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
https://docs.databend.com
Other
7.71k stars 732 forks source link

chore: simplify SchemaApi::truncate_table() #16506

Closed drmingdrmer closed 1 day ago

drmingdrmer commented 2 days ago

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

chore: simplify SchemaApi::truncate_table()
refactor: when SchemaApi::truncate_table(), no need to assert table seq

truncate_table() first lists all copied files belonging to a table, then deletes them in small chunks. The delete operations assert that the seq of each file does not change.

With this approach, there is no need to assert that the seq of the containing table does not change.

refactor: SchemaApi::list_tables() should specify db-id instead of db-name

Tests

Type of change

Related Issues


This change isโ€‚Reviewable

TCeason commented 2 days ago

truncate_table is lgtm