File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -92,15 +92,26 @@ pub async fn refresh_materialized_view(
92
92
Tabular :: Table ( table) => Ok ( * table
93
93
. metadata ( )
94
94
. current_snapshot ( branch. as_deref ( ) ) ?
95
- . unwrap ( )
96
- . snapshot_id ( ) ) ,
97
- Tabular :: MaterializedView ( mv) => Ok ( * mv
98
- . storage_table ( )
99
- . await ?
100
- . table_metadata
101
- . current_snapshot ( branch. as_deref ( ) ) ?
102
- . unwrap ( )
95
+ // Fallback to main branch
96
+ . or ( table. metadata ( ) . current_snapshot ( None ) ?)
97
+ . ok_or ( Error :: NotFound (
98
+ "Snapshot in source table" . to_owned ( ) ,
99
+ format ! ( "{}" , & identifier. table_name( ) ) ,
100
+ ) ) ?
103
101
. snapshot_id ( ) ) ,
102
+ Tabular :: MaterializedView ( mv) => {
103
+ let storage_table = mv. storage_table ( ) . await ?;
104
+ Ok ( * storage_table
105
+ . table_metadata
106
+ . current_snapshot ( branch. as_deref ( ) ) ?
107
+ // Fallback to main branch
108
+ . or ( storage_table. table_metadata . current_snapshot ( None ) ?)
109
+ . ok_or ( Error :: NotFound (
110
+ "Snapshot in source table" . to_owned ( ) ,
111
+ format ! ( "{}" , & identifier. table_name( ) ) ,
112
+ ) ) ?
113
+ . snapshot_id ( ) )
114
+ }
104
115
_ => Err ( Error :: InvalidFormat ( "storage table" . to_string ( ) ) ) ,
105
116
} ?;
106
117
You can’t perform that action at this time.
0 commit comments