-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(query): fix table stats incorrect when create table with exists snapshot #10424
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
6f104a9
to
84ef1b7
Compare
will a new table be left there with incorrect statistics , if How about this?
|
O... the technically, it is not correct, but
|
We can do this modify async fn table_statistics(&self) -> Result<Option<TableStatistics>> {
let s = &self.table_info.meta.statistics;
if s.number_of_rows != 0 {
Ok(Some(TableStatistics {
num_rows: Some(s.number_of_rows),
data_size: Some(s.data_bytes),
data_size_compressed: Some(s.compressed_data_bytes),
index_size: Some(s.index_data_bytes),
}))
} else {
// add read snapshot in there
}
} If num_rows is 0 means the new table or not stat is incorrect, we can read snapshot. |
not sure if besides: there is an implicit constraint for the |
not sure about this, @sundy-li we need your help |
We can not do this. Because the root cause is stats incorrect, in there we can backoff ,but join or other use stats will also generate err result. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation is enough to fix the issue without too much effort.
A hack usage generates a hack modify pr.. How about supporting https://docs.snowflake.com/en/sql-reference/sql/create-clone in a later version? |
That could be great.
|
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
fix table stats incorrect when create table with exists snapshot
When create table with options SNAPSHOT_LOCATION,
after create table , will judge whether the SNAPSHOT_LOCATION actually exists.
If exists, will regenerate the table statistic and recreate table.
if not exists, will drop the table and return err.
Closes #10406