Skip to content

Commit 9608d42

Browse files
manuzhangcodex
andcommitted
style: apply clang-format
Co-authored-by: Codex <codex@openai.com>
1 parent 73dd44a commit 9608d42

7 files changed

Lines changed: 52 additions & 72 deletions

File tree

‎src/iceberg/manifest/manifest_group.cc‎

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ class ManifestGroup::FilePlanningIterator final
140140
ICEBERG_RETURN_UNEXPECTED(group->CheckErrors());
141141

142142
group->delete_index_builder_.WithScanMetrics(group->scan_metrics_);
143-
ICEBERG_ASSIGN_OR_RAISE(auto delete_index,
144-
group->delete_index_builder_.Build());
143+
ICEBERG_ASSIGN_OR_RAISE(auto delete_index, group->delete_index_builder_.Build());
145144

146145
const bool drop_stats = ManifestReader::ShouldDropStats(group->columns_);
147146
if (delete_index->has_equality_deletes()) {
@@ -178,8 +177,7 @@ class ManifestGroup::FilePlanningIterator final
178177
}
179178

180179
auto value = std::move(entry).value();
181-
if (group_->ignore_existing_ &&
182-
value.status == ManifestStatus::kExisting) {
180+
if (group_->ignore_existing_ && value.status == ManifestStatus::kExisting) {
183181
IncrementSkippedDataFiles();
184182
continue;
185183
}
@@ -210,24 +208,19 @@ class ManifestGroup::FilePlanningIterator final
210208
ICEBERG_ASSIGN_OR_RAISE(auto delete_files, delete_index_->ForEntry(value));
211209
UpdateResultMetrics(*value.data_file, delete_files);
212210

213-
ICEBERG_ASSIGN_OR_RAISE(auto residuals,
214-
GetResidualEvaluator(current_spec_id_));
215-
ICEBERG_ASSIGN_OR_RAISE(
216-
auto residual,
217-
residuals->ResidualFor(value.data_file->partition));
211+
ICEBERG_ASSIGN_OR_RAISE(auto residuals, GetResidualEvaluator(current_spec_id_));
212+
ICEBERG_ASSIGN_OR_RAISE(auto residual,
213+
residuals->ResidualFor(value.data_file->partition));
218214

219-
return std::optional<std::shared_ptr<FileScanTask>>{
220-
std::make_shared<FileScanTask>(std::move(value.data_file),
221-
std::move(delete_files),
222-
std::move(residual))};
215+
return std::optional<std::shared_ptr<FileScanTask>>{std::make_shared<FileScanTask>(
216+
std::move(value.data_file), std::move(delete_files), std::move(residual))};
223217
}
224218
}
225219

226220
private:
227221
FilePlanningIterator(std::unique_ptr<ManifestGroup> group,
228222
std::unique_ptr<DeleteFileIndex> delete_index,
229-
std::unique_ptr<Evaluator> data_file_evaluator,
230-
bool drop_stats)
223+
std::unique_ptr<Evaluator> data_file_evaluator, bool drop_stats)
231224
: group_(std::move(group)),
232225
delete_index_(std::move(delete_index)),
233226
data_file_evaluator_(std::move(data_file_evaluator)),
@@ -248,14 +241,12 @@ class ManifestGroup::FilePlanningIterator final
248241
Projections::Inclusive(*spec, *group_->schema_, group_->case_sensitive_);
249242
ICEBERG_ASSIGN_OR_RAISE(auto partition_filter,
250243
projector->Project(group_->data_filter_));
251-
ICEBERG_ASSIGN_OR_RAISE(
252-
partition_filter,
253-
And::Make(std::move(partition_filter), group_->partition_filter_));
254-
ICEBERG_ASSIGN_OR_RAISE(
255-
auto evaluator,
256-
ManifestEvaluator::MakePartitionFilter(std::move(partition_filter), spec,
257-
*group_->schema_,
258-
group_->case_sensitive_));
244+
ICEBERG_ASSIGN_OR_RAISE(partition_filter, And::Make(std::move(partition_filter),
245+
group_->partition_filter_));
246+
ICEBERG_ASSIGN_OR_RAISE(auto evaluator,
247+
ManifestEvaluator::MakePartitionFilter(
248+
std::move(partition_filter), spec, *group_->schema_,
249+
group_->case_sensitive_));
259250
auto* result = evaluator.get();
260251
manifest_evaluators_.emplace(spec_id, std::move(evaluator));
261252
return result;
@@ -286,10 +277,8 @@ class ManifestGroup::FilePlanningIterator final
286277
const auto& manifest = group_->data_manifests_[next_manifest_++];
287278
const int32_t spec_id = manifest.partition_spec_id;
288279

289-
ICEBERG_ASSIGN_OR_RAISE(auto evaluator,
290-
GetManifestEvaluator(spec_id));
291-
ICEBERG_ASSIGN_OR_RAISE(bool should_match,
292-
evaluator->Evaluate(manifest));
280+
ICEBERG_ASSIGN_OR_RAISE(auto evaluator, GetManifestEvaluator(spec_id));
281+
ICEBERG_ASSIGN_OR_RAISE(bool should_match, evaluator->Evaluate(manifest));
293282
if (!should_match) {
294283
IncrementSkippedDataManifests();
295284
continue;
@@ -310,10 +299,9 @@ class ManifestGroup::FilePlanningIterator final
310299
}
311300

312301
ICEBERG_ASSIGN_OR_RAISE(auto reader, group_->MakeReader(manifest));
313-
ICEBERG_ASSIGN_OR_RAISE(
314-
entry_iterator_,
315-
group_->ignore_deleted_ ? reader->LiveEntriesIterator()
316-
: reader->EntriesIterator());
302+
ICEBERG_ASSIGN_OR_RAISE(entry_iterator_, group_->ignore_deleted_
303+
? reader->LiveEntriesIterator()
304+
: reader->EntriesIterator());
317305
current_spec_id_ = spec_id;
318306
return true;
319307
}
@@ -332,9 +320,8 @@ class ManifestGroup::FilePlanningIterator final
332320
}
333321
}
334322

335-
void UpdateResultMetrics(
336-
const DataFile& data_file,
337-
const std::vector<std::shared_ptr<DataFile>>& delete_files) {
323+
void UpdateResultMetrics(const DataFile& data_file,
324+
const std::vector<std::shared_ptr<DataFile>>& delete_files) {
338325
if (!group_->scan_metrics_) {
339326
return;
340327
}
@@ -354,10 +341,8 @@ class ManifestGroup::FilePlanningIterator final
354341
std::unique_ptr<ManifestGroup> group_;
355342
std::unique_ptr<DeleteFileIndex> delete_index_;
356343
std::unique_ptr<Evaluator> data_file_evaluator_;
357-
std::unordered_map<int32_t, std::unique_ptr<ManifestEvaluator>>
358-
manifest_evaluators_;
359-
std::unordered_map<int32_t, std::shared_ptr<ResidualEvaluator>>
360-
residual_evaluators_;
344+
std::unordered_map<int32_t, std::unique_ptr<ManifestEvaluator>> manifest_evaluators_;
345+
std::unordered_map<int32_t, std::shared_ptr<ResidualEvaluator>> residual_evaluators_;
361346
std::unique_ptr<Iterator<ManifestEntry>> entry_iterator_;
362347
size_t next_manifest_ = 0;
363348
int32_t current_spec_id_ = 0;

‎src/iceberg/manifest/manifest_group.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ class ICEBERG_EXPORT ManifestGroup : public ErrorCollector {
144144
/// and scan tasks. Creating the iterator consumes this group's configuration. Streaming
145145
/// planning is pull-based and does not eagerly submit manifests to the executor set by
146146
/// PlanWith().
147-
Result<std::unique_ptr<Iterator<std::shared_ptr<FileScanTask>>>>
148-
PlanFilesIterator();
147+
Result<std::unique_ptr<Iterator<std::shared_ptr<FileScanTask>>>> PlanFilesIterator();
149148

150149
/// \brief Get all matching manifest entries.
151150
Result<std::vector<ManifestEntry>> Entries();

‎src/iceberg/manifest/manifest_reader.cc‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -709,15 +709,14 @@ class VectorIterator final : public Iterator<T> {
709709

710710
class ManifestEntryIteratorImpl final : public Iterator<ManifestEntry> {
711711
public:
712-
ManifestEntryIteratorImpl(
713-
std::unique_ptr<Reader> reader, std::shared_ptr<Schema> file_schema,
714-
ArrowSchema arrow_schema,
715-
std::shared_ptr<InheritableMetadata> inheritable_metadata,
716-
std::optional<int64_t> first_row_id, bool is_committed, bool only_live,
717-
std::unique_ptr<Evaluator> evaluator,
718-
std::unique_ptr<InclusiveMetricsEvaluator> metrics_evaluator,
719-
std::shared_ptr<PartitionSet> partition_set, std::shared_ptr<Counter> skip_counter,
720-
bool drop_stats)
712+
ManifestEntryIteratorImpl(std::unique_ptr<Reader> reader,
713+
std::shared_ptr<Schema> file_schema, ArrowSchema arrow_schema,
714+
std::shared_ptr<InheritableMetadata> inheritable_metadata,
715+
std::optional<int64_t> first_row_id, bool is_committed,
716+
bool only_live, std::unique_ptr<Evaluator> evaluator,
717+
std::unique_ptr<InclusiveMetricsEvaluator> metrics_evaluator,
718+
std::shared_ptr<PartitionSet> partition_set,
719+
std::shared_ptr<Counter> skip_counter, bool drop_stats)
721720
: reader_(std::move(reader)),
722721
file_schema_(std::move(file_schema)),
723722
arrow_schema_(std::exchange(arrow_schema, ArrowSchema{})),
@@ -744,9 +743,8 @@ class ManifestEntryIteratorImpl final : public Iterator<ManifestEntry> {
744743

745744
ICEBERG_DCHECK(entry.data_file != nullptr, "Data file cannot be null");
746745
if (evaluator_) {
747-
ICEBERG_ASSIGN_OR_RAISE(
748-
bool partition_match,
749-
evaluator_->Evaluate(entry.data_file->partition));
746+
ICEBERG_ASSIGN_OR_RAISE(bool partition_match,
747+
evaluator_->Evaluate(entry.data_file->partition));
750748
if (!partition_match) {
751749
IncrementSkipCounter();
752750
continue;
@@ -1010,12 +1008,13 @@ Result<std::unique_ptr<Iterator<ManifestEntry>>> ManifestReaderImpl::EntriesIter
10101008
return MakeEntriesIterator(/*only_live=*/false);
10111009
}
10121010

1013-
Result<std::unique_ptr<Iterator<ManifestEntry>>> ManifestReaderImpl::LiveEntriesIterator() {
1011+
Result<std::unique_ptr<Iterator<ManifestEntry>>>
1012+
ManifestReaderImpl::LiveEntriesIterator() {
10141013
return MakeEntriesIterator(/*only_live=*/true);
10151014
}
10161015

1017-
Result<std::unique_ptr<Iterator<ManifestEntry>>>
1018-
ManifestReaderImpl::MakeEntriesIterator(bool only_live) {
1016+
Result<std::unique_ptr<Iterator<ManifestEntry>>> ManifestReaderImpl::MakeEntriesIterator(
1017+
bool only_live) {
10191018
ICEBERG_ASSIGN_OR_RAISE(auto partition_type, spec_->RawPartitionType(*schema_));
10201019
auto data_file_schema = DataFile::Type(std::move(partition_type))->ToSchema();
10211020

‎src/iceberg/manifest/manifest_reader.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class ICEBERG_EXPORT ManifestReader {
5151
/// \brief Lazily read manifest entries.
5252
///
5353
/// The returned iterator reads and filters one underlying record batch at a time. This
54-
/// bounds memory use for large manifests. The iterator owns its reader resources and may
55-
/// outlive this ManifestReader.
54+
/// bounds memory use for large manifests. The iterator owns its reader resources and
55+
/// may outlive this ManifestReader.
5656
virtual Result<std::unique_ptr<Iterator<ManifestEntry>>> EntriesIterator();
5757

5858
/// \brief Lazily read only live (non-deleted) manifest entries.

‎src/iceberg/table_scan.cc‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ Result<ScanReport> MakeScanReport(const DataTableScan& scan, const Snapshot& sna
9191
projected_field_names.emplace_back(*field_name);
9292
}
9393

94-
ICEBERG_ASSIGN_OR_RAISE(
95-
auto sanitized_filter,
96-
SanitizeExpression::Sanitize(*schema_ptr, scan.filter(),
97-
scan.context().case_sensitive));
94+
ICEBERG_ASSIGN_OR_RAISE(auto sanitized_filter,
95+
SanitizeExpression::Sanitize(*schema_ptr, scan.filter(),
96+
scan.context().case_sensitive));
9897

9998
return ScanReport{
10099
.table_name = scan.context().table_name,
@@ -108,8 +107,7 @@ Result<ScanReport> MakeScanReport(const DataTableScan& scan, const Snapshot& sna
108107
};
109108
}
110109

111-
class ReportingFileTaskIterator final
112-
: public Iterator<std::shared_ptr<FileScanTask>> {
110+
class ReportingFileTaskIterator final : public Iterator<std::shared_ptr<FileScanTask>> {
113111
public:
114112
ReportingFileTaskIterator(
115113
std::unique_ptr<Iterator<std::shared_ptr<FileScanTask>>> iterator,
@@ -780,10 +778,9 @@ DataTableScan::PlanFilesIterator() const {
780778
}
781779

782780
return std::unique_ptr<Iterator<std::shared_ptr<FileScanTask>>>(
783-
new ReportingFileTaskIterator(
784-
std::move(iterator), std::move(scan_metrics), planning_duration,
785-
context_.metrics_reporter,
786-
std::move(report).value()));
781+
new ReportingFileTaskIterator(std::move(iterator), std::move(scan_metrics),
782+
planning_duration, context_.metrics_reporter,
783+
std::move(report).value()));
787784
}
788785

789786
// Friend function template for IncrementalScan that implements the shared PlanFiles

‎src/iceberg/table_scan.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,8 @@ class ICEBERG_EXPORT DataTableScan : public TableScan {
468468
///
469469
/// Unlike PlanFiles(), this method does not materialize all manifest entries and scan
470470
/// tasks. The iterator owns its planning resources and can outlive this scan.
471-
Result<std::unique_ptr<Iterator<std::shared_ptr<FileScanTask>>>>
472-
PlanFilesIterator() const;
471+
Result<std::unique_ptr<Iterator<std::shared_ptr<FileScanTask>>>> PlanFilesIterator()
472+
const;
473473

474474
private:
475475
Status ReportScan(const Snapshot& snapshot, const ScanMetrics& scan_metrics) const;

‎src/iceberg/test/table_scan_test.cc‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,9 @@ TEST_P(TableScanTest, PlanFilesWithDataManifests) {
389389
scan.reset();
390390
ICEBERG_UNWRAP_OR_FAIL(auto streamed_tasks, iterator->ToVector());
391391
ASSERT_EQ(streamed_tasks.size(), 2);
392-
EXPECT_THAT(GetPaths(streamed_tasks),
393-
testing::UnorderedElementsAre("/path/to/data1.parquet",
394-
"/path/to/data2.parquet"));
392+
EXPECT_THAT(
393+
GetPaths(streamed_tasks),
394+
testing::UnorderedElementsAre("/path/to/data1.parquet", "/path/to/data2.parquet"));
395395
}
396396

397397
TEST_P(TableScanTest, PlanRowLineage) {

0 commit comments

Comments
 (0)