4343#include " iceberg/sort_order.h"
4444#include " iceberg/table.h"
4545#include " iceberg/table_requirement.h"
46- #include " iceberg/table_scan.h"
4746#include " iceberg/table_update.h"
4847#include " iceberg/transaction.h"
4948#include " iceberg/util/macros.h"
@@ -63,8 +62,6 @@ std::unordered_set<Endpoint> GetDefaultEndpoints() {
6362 Endpoint::UpdateTable (), Endpoint::DeleteTable (),
6463 Endpoint::RenameTable (), Endpoint::RegisterTable (),
6564 Endpoint::ReportMetrics (), Endpoint::CommitTransaction (),
66- Endpoint::PlanTableScan (), Endpoint::FetchPlanningResult (),
67- Endpoint::CancelPlanning (), Endpoint::FetchScanTasks (),
6865 };
6966}
7067
@@ -498,85 +495,4 @@ Result<std::shared_ptr<Table>> RestCatalog::RegisterTable(
498495 shared_from_this ());
499496}
500497
501- Result<PlanTableScanResponse> RestCatalog::PlanTableScan (
502- const Table& table, const internal::TableScanContext& context) {
503- ICEBERG_ENDPOINT_CHECK (supported_endpoints_, Endpoint::PlanTableScan ());
504- ICEBERG_ASSIGN_OR_RAISE (auto path, paths_->Plan (table.name ()));
505- ICEBERG_ASSIGN_OR_RAISE (auto schema_ptr, table.schema ());
506- ICEBERG_ASSIGN_OR_RAISE (auto specs_ref, table.specs ());
507-
508- PlanTableScanRequest request;
509- if (context.snapshot_id .has_value ()) {
510- request.snapshot_id = context.snapshot_id ;
511- }
512- request.select = context.selected_columns ;
513- request.filter = context.filter ;
514- request.case_sensitive = context.case_sensitive ;
515- request.use_snapshot_schema = false ;
516- if (context.from_snapshot_id .has_value () && context.to_snapshot_id .has_value ()) {
517- request.start_snapshot_id = context.from_snapshot_id .value ();
518- request.end_snapshot_id = context.to_snapshot_id .value ();
519- request.use_snapshot_schema = true ;
520- }
521- if (context.min_rows_requested .has_value ()) {
522- request.min_rows_requested = context.min_rows_requested .value ();
523- }
524-
525- ICEBERG_RETURN_UNEXPECTED (request.Validate ());
526- ICEBERG_ASSIGN_OR_RAISE (auto request_json, ToJson (request));
527- ICEBERG_ASSIGN_OR_RAISE (auto json_request, ToJsonString (request_json));
528- ICEBERG_ASSIGN_OR_RAISE (
529- const auto response,
530- client_->Post (path, json_request, /* headers=*/ {}, *PlanErrorHandler::Instance (),
531- *catalog_session_));
532-
533- ICEBERG_ASSIGN_OR_RAISE (auto json, FromJsonString (response.body ()));
534- return PlanTableScanResponseFromJson (json, specs_ref.get (), *schema_ptr);
535- }
536-
537- Result<FetchPlanningResultResponse> RestCatalog::FetchPlanningResult (
538- const Table& table, const std::string& plan_id) {
539- ICEBERG_ENDPOINT_CHECK (supported_endpoints_, Endpoint::FetchPlanningResult ());
540- ICEBERG_ASSIGN_OR_RAISE (auto path, paths_->Plan (table.name (), plan_id));
541- ICEBERG_ASSIGN_OR_RAISE (auto schema_ptr, table.schema ());
542- ICEBERG_ASSIGN_OR_RAISE (auto specs_ref, table.specs ());
543-
544- ICEBERG_ASSIGN_OR_RAISE (
545- const auto response,
546- client_->Get (path, /* params=*/ {}, /* headers=*/ {}, *PlanErrorHandler::Instance (),
547- *catalog_session_));
548- ICEBERG_ASSIGN_OR_RAISE (auto json, FromJsonString (response.body ()));
549- return FetchPlanningResultResponseFromJson (json, specs_ref.get (), *schema_ptr);
550- }
551-
552- Status RestCatalog::CancelPlanning (const Table& table, const std::string& plan_id) {
553- ICEBERG_ENDPOINT_CHECK (supported_endpoints_, Endpoint::CancelPlanning ());
554- ICEBERG_ASSIGN_OR_RAISE (auto path, paths_->Plan (table.name (), plan_id));
555-
556- ICEBERG_ASSIGN_OR_RAISE (
557- const auto response,
558- client_->Delete (path, /* params=*/ {}, /* headers=*/ {},
559- *PlanErrorHandler::Instance (), *catalog_session_));
560- return {};
561- }
562-
563- Result<FetchScanTasksResponse> RestCatalog::FetchScanTasks (const Table& table,
564- const std::string& plan_task) {
565- ICEBERG_ENDPOINT_CHECK (supported_endpoints_, Endpoint::FetchScanTasks ());
566- ICEBERG_ASSIGN_OR_RAISE (auto path, paths_->FetchScanTasks (table.name ()));
567- ICEBERG_ASSIGN_OR_RAISE (auto schema_ptr, table.schema ());
568- ICEBERG_ASSIGN_OR_RAISE (auto specs_ref, table.specs ());
569-
570- FetchScanTasksRequest request{.planTask = plan_task};
571- ICEBERG_RETURN_UNEXPECTED (request.Validate ());
572- ICEBERG_ASSIGN_OR_RAISE (auto json_request, ToJsonString (ToJson (request)));
573- ICEBERG_ASSIGN_OR_RAISE (
574- const auto response,
575- client_->Post (path, json_request, /* headers=*/ {}, *PlanTaskErrorHandler::Instance (),
576- *catalog_session_));
577-
578- ICEBERG_ASSIGN_OR_RAISE (auto json, FromJsonString (response.body ()));
579- return FetchScanTasksResponseFromJson (json, specs_ref.get (), *schema_ptr);
580- }
581-
582498} // namespace iceberg::rest
0 commit comments