Skip to content

Commit 1b5d123

Browse files
committed
resolve some comments
1 parent 0ff952b commit 1b5d123

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

src/iceberg/manifest_reader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ class ICEBERG_EXPORT ManifestListReader {
5555
/// \param file_path Path to the manifest list file.
5656
/// \return A Result containing the reader or an error.
5757
Result<std::unique_ptr<ManifestListReader>> CreateManifestListReader(
58-
const std::string& file_path) {
58+
const std::string_view& file_path) {
5959
return NotImplemented("CreateManifestListReader is not implemented yet.");
6060
}
6161

6262
/// \brief Creates a reader for a manifest file.
6363
/// \param file_path Path to the manifest file.
6464
/// \return A Result containing the reader or an error.
6565
Result<std::unique_ptr<ManifestReader>> CreateManifestReader(
66-
const std::string& file_path) {
66+
const std::string_view& file_path) {
6767
return NotImplemented("CreateManifestReader is not implemented yet.");
6868
}
6969

src/iceberg/table_scan.cc

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,9 @@ std::vector<std::shared_ptr<DataFile>> GetMatchedDeletes(
8888
// implement FileScanTask
8989
FileScanTask::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

9996
const 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-
109102
int64_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
}

src/iceberg/table_scan.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,15 @@ class ICEBERG_EXPORT ScanTask {
4646
class ICEBERG_EXPORT FileScanTask : public ScanTask {
4747
public:
4848
FileScanTask(std::shared_ptr<DataFile> file,
49-
std::vector<std::shared_ptr<DataFile>> delete_files, int64_t start,
50-
int64_t length, std::shared_ptr<Expression> residual);
49+
std::vector<std::shared_ptr<DataFile>> delete_files,
50+
std::shared_ptr<Expression> residual);
5151

5252
/// \brief The data file that should be read by this scan task.
5353
const std::shared_ptr<DataFile>& data_file() const;
5454

5555
/// \brief The delete files that should be read by this scan task.
5656
const std::vector<std::shared_ptr<DataFile>>& delete_files() const;
5757

58-
/// \brief The byte offset in the data file where the scan should start.
59-
int64_t start() const;
60-
61-
/// \brief The length in bytes to scan from the start offset.
62-
int64_t length() const;
63-
6458
/// \brief The residual expression to apply after scanning the data file.
6559
const std::shared_ptr<Expression>& residual() const;
6660

@@ -73,10 +67,6 @@ class ICEBERG_EXPORT FileScanTask : public ScanTask {
7367
std::shared_ptr<DataFile> data_file_;
7468
/// \brief Delete files metadata.
7569
std::vector<std::shared_ptr<DataFile>> delete_files_;
76-
/// \brief Start byte offset.
77-
int64_t start_;
78-
/// \brief Length in bytes to scan.
79-
int64_t length_;
8070
/// \brief Residual expression to apply.
8171
std::shared_ptr<Expression> residual_;
8272
};

0 commit comments

Comments
 (0)