@@ -100,10 +100,7 @@ impl<'a> SnapshotProducer<'a> {
100
100
}
101
101
}
102
102
103
- pub ( crate ) fn validate_added_data_files (
104
- table : & Table ,
105
- added_data_files : & [ DataFile ] ,
106
- ) -> Result < ( ) > {
103
+ pub ( crate ) fn validate_added_data_files ( & self , added_data_files : & [ DataFile ] ) -> Result < ( ) > {
107
104
for data_file in added_data_files {
108
105
if data_file. content_type ( ) != crate :: spec:: DataContentType :: Data {
109
106
return Err ( Error :: new (
@@ -112,23 +109,23 @@ impl<'a> SnapshotProducer<'a> {
112
109
) ) ;
113
110
}
114
111
// Check if the data file partition spec id matches the table default partition spec id.
115
- if table. metadata ( ) . default_partition_spec_id ( ) != data_file. partition_spec_id {
112
+ if self . table . metadata ( ) . default_partition_spec_id ( ) != data_file. partition_spec_id {
116
113
return Err ( Error :: new (
117
114
ErrorKind :: DataInvalid ,
118
115
"Data file partition spec id does not match table default partition spec id" ,
119
116
) ) ;
120
117
}
121
118
Self :: validate_partition_value (
122
119
data_file. partition ( ) ,
123
- table. metadata ( ) . default_partition_type ( ) ,
120
+ self . table . metadata ( ) . default_partition_type ( ) ,
124
121
) ?;
125
122
}
126
123
127
124
Ok ( ( ) )
128
125
}
129
126
130
127
pub ( crate ) async fn validate_duplicate_files (
131
- table : & Table ,
128
+ & self ,
132
129
added_data_files : & [ DataFile ] ,
133
130
) -> Result < ( ) > {
134
131
let new_files: HashSet < & str > = added_data_files
@@ -137,12 +134,14 @@ impl<'a> SnapshotProducer<'a> {
137
134
. collect ( ) ;
138
135
139
136
let mut referenced_files = Vec :: new ( ) ;
140
- if let Some ( current_snapshot) = table. metadata ( ) . current_snapshot ( ) {
137
+ if let Some ( current_snapshot) = self . table . metadata ( ) . current_snapshot ( ) {
141
138
let manifest_list = current_snapshot
142
- . load_manifest_list ( table. file_io ( ) , & table. metadata_ref ( ) )
139
+ . load_manifest_list ( self . table . file_io ( ) , & self . table . metadata_ref ( ) )
143
140
. await ?;
144
141
for manifest_list_entry in manifest_list. entries ( ) {
145
- let manifest = manifest_list_entry. load_manifest ( table. file_io ( ) ) . await ?;
142
+ let manifest = manifest_list_entry
143
+ . load_manifest ( self . table . file_io ( ) )
144
+ . await ?;
146
145
for entry in manifest. entries ( ) {
147
146
let file_path = entry. file_path ( ) ;
148
147
if new_files. contains ( file_path) && entry. is_alive ( ) {
0 commit comments