Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions example/demo_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,26 @@ int main(int argc, char** argv) {
}

auto scan = std::move(scan_result.value());
auto plan_result = scan->PlanFiles();
auto plan_result = scan->PlanFilesIterator();
if (!plan_result.has_value()) {
std::cerr << "Failed to plan files: " << plan_result.error().message << std::endl;
return 1;
}

std::cout << "Scan tasks: " << std::endl;
auto scan_tasks = std::move(plan_result.value());
for (const auto& scan_task : scan_tasks) {
std::cout << " - " << scan_task->data_file()->file_path << std::endl;
while (true) {
auto task_result = scan_tasks->Next();
if (!task_result.has_value()) {
std::cerr << "Failed to plan next file: " << task_result.error().message
<< std::endl;
return 1;
}
if (!task_result.value().has_value()) {
break;
}
std::cout << " - " << task_result.value().value()->data_file()->file_path
<< std::endl;
}

return 0;
Expand Down
35 changes: 35 additions & 0 deletions src/iceberg/file_scan_task_iterator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

#pragma once

/// \file iceberg/file_scan_task_iterator.h
/// \brief Define the owning iterator type for file scan tasks.

#include <memory>

#include "iceberg/util/iterator.h"

namespace iceberg {

class FileScanTask;

using FileScanTaskIterator = std::unique_ptr<Iterator<std::shared_ptr<FileScanTask>>>;

} // namespace iceberg
Loading
Loading