@@ -88,12 +88,9 @@ std::vector<std::shared_ptr<DataFile>> GetMatchedDeletes(
8888// implement FileScanTask
8989FileScanTask::FileScanTask (std::shared_ptr<DataFile> file,
9090 std::vector<std::shared_ptr<DataFile>> delete_files,
91- int64_t start, int64_t length,
9291 std::shared_ptr<Expression> residual)
9392 : data_file_(std::move(file)),
9493 delete_files_ (std::move(delete_files)),
95- start_(start),
96- length_(length),
9794 residual_(std::move(residual)) {}
9895
9996const std::shared_ptr<DataFile>& FileScanTask::data_file () const { return data_file_; }
@@ -102,12 +99,8 @@ const std::vector<std::shared_ptr<DataFile>>& FileScanTask::delete_files() const
10299 return delete_files_;
103100}
104101
105- int64_t FileScanTask::start () const { return start_; }
106-
107- int64_t FileScanTask::length () const { return length_; }
108-
109102int64_t FileScanTask::SizeBytes () const {
110- int64_t sizeInBytes = length_ ;
103+ int64_t sizeInBytes = data_file_-> file_size_in_bytes ;
111104 std::ranges::for_each (delete_files_, [&sizeInBytes](const auto & delete_file) {
112105 sizeInBytes += delete_file->file_size_in_bytes ;
113106 });
@@ -122,8 +115,9 @@ int64_t FileScanTask::EstimatedRowCount() const {
122115 if (data_file_->file_size_in_bytes == 0 ) {
123116 return 0 ;
124117 }
118+ const auto sizeInBytes = data_file_->file_size_in_bytes ;
125119 const double scannedFileFraction =
126- static_cast <double >(length_ ) / data_file_->file_size_in_bytes ;
120+ static_cast <double >(sizeInBytes ) / data_file_->file_size_in_bytes ;
127121 return static_cast <int64_t >(scannedFileFraction * data_file_->record_count );
128122}
129123
@@ -276,17 +270,15 @@ Result<std::vector<std::shared_ptr<FileScanTask>>> DataScan::PlanFiles() const {
276270 }
277271 }
278272
279- DeleteFileIndex delete_file_index (positional_delete_entries);
280-
281273 // TODO(gty404): build residual expression from filter
282274 std::shared_ptr<Expression> residual;
283275 std::vector<std::shared_ptr<FileScanTask>> tasks;
276+ DeleteFileIndex delete_file_index (positional_delete_entries);
284277 for (const auto & data_entry : data_entries) {
285278 auto matched_deletes = GetMatchedDeletes (*data_entry, delete_file_index);
286279 const auto & data_file = data_entry->data_file ;
287280 tasks.emplace_back (std::make_shared<FileScanTask>(
288- data_file, std::move (matched_deletes), 0 , data_file->file_size_in_bytes ,
289- std::move (residual)));
281+ data_file, std::move (matched_deletes), std::move (residual)));
290282 }
291283 return tasks;
292284}
0 commit comments