gsandeep1241 commented on code in PR #783:
URL: https://github.com/apache/iceberg-cpp/pull/783#discussion_r4130102615


##########
src/iceberg/catalog/rest/rest_table_scan.h:
##########
@@ -0,0 +1,137 @@
+/*
+ * 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
+
+#include <memory>
+#include <string>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+#include "iceberg/catalog/rest/endpoint.h"
+#include "iceberg/catalog/rest/iceberg_rest_export.h"
+#include "iceberg/metrics/metrics_reporter.h"
+#include "iceberg/result.h"
+#include "iceberg/storage_credential.h"
+#include "iceberg/table_identifier.h"
+#include "iceberg/table_scan.h"
+#include "iceberg/type_fwd.h"
+
+/// \file iceberg/catalog/rest/rest_table_scan.h
+/// REST-specific table scan that delegates scan planning to the REST catalog 
server.
+
+namespace iceberg::rest {
+
+class HttpClient;
+class ResourcePaths;
+
+namespace auth {
+class AuthSession;
+}  // namespace auth
+
+/// \brief HTTP context shared between RestTable and RestTableScan.
+struct ICEBERG_REST_EXPORT RestScanContext {
+  std::shared_ptr<HttpClient> client;
+  std::shared_ptr<ResourcePaths> paths;
+  std::shared_ptr<auth::AuthSession> session;
+  std::unordered_set<Endpoint> supported_endpoints;
+  TableIdentifier identifier;
+  /// Catalog-level config, used with table_config to build a scan-scoped 
FileIO
+  /// when the server vends storage credentials in a planning response.
+  std::unordered_map<std::string, std::string> catalog_config;
+  /// Table-level config merged with catalog_config for scan-scoped FileIO 
creation.
+  std::unordered_map<std::string, std::string> table_config;
+};
+
+/// \brief A DataTableScan that delegates PlanFiles() to the REST catalog 
server
+/// via the scan planning endpoints (planTableScan / fetchPlanningResult /
+/// cancelPlanning / fetchScanTasks).
+class ICEBERG_REST_EXPORT RestTableScan : public DataTableScan {
+ public:
+  ~RestTableScan() override = default;
+
+  static Result<std::unique_ptr<DataTableScan>> Make(
+      std::shared_ptr<TableMetadata> metadata, std::shared_ptr<Schema> schema,
+      std::shared_ptr<FileIO> io, internal::TableScanContext context,
+      RestScanContext rest_context);
+
+  /// \brief Plans files via the REST scan planning endpoints.
+  Result<std::vector<std::shared_ptr<FileScanTask>>> PlanFiles() const 
override;

Review Comment:
   Done.



##########
src/iceberg/catalog/rest/rest_table_scan.h:
##########
@@ -0,0 +1,137 @@
+/*
+ * 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
+
+#include <memory>
+#include <string>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+#include "iceberg/catalog/rest/endpoint.h"
+#include "iceberg/catalog/rest/iceberg_rest_export.h"
+#include "iceberg/metrics/metrics_reporter.h"
+#include "iceberg/result.h"
+#include "iceberg/storage_credential.h"
+#include "iceberg/table_identifier.h"
+#include "iceberg/table_scan.h"
+#include "iceberg/type_fwd.h"
+
+/// \file iceberg/catalog/rest/rest_table_scan.h
+/// REST-specific table scan that delegates scan planning to the REST catalog 
server.
+
+namespace iceberg::rest {
+
+class HttpClient;
+class ResourcePaths;
+
+namespace auth {
+class AuthSession;
+}  // namespace auth
+
+/// \brief HTTP context shared between RestTable and RestTableScan.
+struct ICEBERG_REST_EXPORT RestScanContext {
+  std::shared_ptr<HttpClient> client;
+  std::shared_ptr<ResourcePaths> paths;
+  std::shared_ptr<auth::AuthSession> session;
+  std::unordered_set<Endpoint> supported_endpoints;
+  TableIdentifier identifier;
+  /// Catalog-level config, used with table_config to build a scan-scoped 
FileIO
+  /// when the server vends storage credentials in a planning response.
+  std::unordered_map<std::string, std::string> catalog_config;
+  /// Table-level config merged with catalog_config for scan-scoped FileIO 
creation.
+  std::unordered_map<std::string, std::string> table_config;
+};
+
+/// \brief A DataTableScan that delegates PlanFiles() to the REST catalog 
server
+/// via the scan planning endpoints (planTableScan / fetchPlanningResult /
+/// cancelPlanning / fetchScanTasks).
+class ICEBERG_REST_EXPORT RestTableScan : public DataTableScan {
+ public:
+  ~RestTableScan() override = default;
+
+  static Result<std::unique_ptr<DataTableScan>> Make(
+      std::shared_ptr<TableMetadata> metadata, std::shared_ptr<Schema> schema,
+      std::shared_ptr<FileIO> io, internal::TableScanContext context,
+      RestScanContext rest_context);
+
+  /// \brief Plans files via the REST scan planning endpoints.
+  Result<std::vector<std::shared_ptr<FileScanTask>>> PlanFiles() const 
override;
+
+  /// \brief Returns the FileIO to use when reading scan results.
+  ///
+  /// If the server vended storage credentials during planning, returns a 
FileIO
+  /// initialised with those credentials; otherwise returns the table's FileIO.
+  /// Must be called after PlanFiles().
+  const std::shared_ptr<FileIO>& effective_io() const;

Review Comment:
   Done, thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to