@@ -93,9 +93,40 @@ constexpr std::string_view kUseSnapshotSchema = "use-snapshot-schema";
9393constexpr std::string_view kStartSnapshotId = " start-snapshot-id" ;
9494constexpr std::string_view kEndSnapshotId = " end-snapshot-id" ;
9595constexpr std::string_view kStatsFields = " stats-fields" ;
96- constexpr std::string_view kMinRowsRequired = " min-rows-required " ;
96+ constexpr std::string_view kMinRowsRequested = " min-rows-requested " ;
9797constexpr std::string_view kPlanTask = " plan-task" ;
9898
99+ Status BaseScanTaskResponseFromJson (
100+ const nlohmann::json& json, BaseScanTaskResponse* response,
101+ const std::unordered_map<int32_t , std::shared_ptr<PartitionSpec>>&
102+ partition_specs_by_id,
103+ const Schema& schema) {
104+ // 1. plan_tasks
105+ ICEBERG_ASSIGN_OR_RAISE (
106+ response->plan_tasks ,
107+ GetJsonValueOrDefault<std::vector<std::string>>(json, kPlanTasks ));
108+
109+ // 2. delete_files
110+ ICEBERG_ASSIGN_OR_RAISE (
111+ auto delete_files_json,
112+ GetJsonValueOrDefault<nlohmann::json>(json, kDeleteFiles , nlohmann::json::array ()));
113+ for (const auto & entry_json : delete_files_json) {
114+ ICEBERG_ASSIGN_OR_RAISE (auto delete_file,
115+ DataFileFromJson (entry_json, partition_specs_by_id, schema));
116+ response->delete_files .push_back (std::move (delete_file));
117+ }
118+
119+ // 3. file_scan_tasks
120+ ICEBERG_ASSIGN_OR_RAISE (auto file_scan_tasks_json,
121+ GetJsonValueOrDefault<nlohmann::json>(json, kFileScanTasks ,
122+ nlohmann::json::array ()));
123+ ICEBERG_ASSIGN_OR_RAISE (
124+ response->file_scan_tasks ,
125+ FileScanTasksFromJson (file_scan_tasks_json, response->delete_files ,
126+ partition_specs_by_id, schema));
127+ return {};
128+ }
129+
99130} // namespace
100131
101132nlohmann::json ToJson (const CatalogConfig& config) {
@@ -547,7 +578,7 @@ Result<nlohmann::json> ToJson(const PlanTableScanRequest& request) {
547578 json[kStatsFields ] = request.statsFields ;
548579 }
549580 if (request.min_rows_required .has_value ()) {
550- json[kMinRowsRequired ] = request.min_rows_required .value ();
581+ json[kMinRowsRequested ] = request.min_rows_required .value ();
551582 }
552583 return json;
553584}
@@ -558,37 +589,6 @@ nlohmann::json ToJson(const FetchScanTasksRequest& request) {
558589 return json;
559590}
560591
561- Status BaseScanTaskResponseFromJson (
562- const nlohmann::json& json, BaseScanTaskResponse* response,
563- const std::unordered_map<int32_t , std::shared_ptr<PartitionSpec>>&
564- partition_specs_by_id,
565- const Schema& schema) {
566- // 1. plan_tasks
567- ICEBERG_ASSIGN_OR_RAISE (
568- response->plan_tasks ,
569- GetJsonValueOrDefault<std::vector<std::string>>(json, kPlanTasks ));
570-
571- // 2. delete_files
572- ICEBERG_ASSIGN_OR_RAISE (
573- auto delete_files_json,
574- GetJsonValueOrDefault<nlohmann::json>(json, kDeleteFiles , nlohmann::json::array ()));
575- for (const auto & entry_json : delete_files_json) {
576- ICEBERG_ASSIGN_OR_RAISE (auto delete_file,
577- DataFileFromJson (entry_json, partition_specs_by_id, schema));
578- response->delete_files .push_back (std::move (delete_file));
579- }
580-
581- // 3. file_scan_tasks
582- ICEBERG_ASSIGN_OR_RAISE (auto file_scan_tasks_json,
583- GetJsonValueOrDefault<nlohmann::json>(json, kFileScanTasks ,
584- nlohmann::json::array ()));
585- ICEBERG_ASSIGN_OR_RAISE (
586- response->file_scan_tasks ,
587- FileScanTasksFromJson (file_scan_tasks_json, response->delete_files ,
588- partition_specs_by_id, schema));
589- return {};
590- }
591-
592592Result<PlanTableScanResponse> PlanTableScanResponseFromJson (
593593 const nlohmann::json& json,
594594 const std::unordered_map<int32_t , std::shared_ptr<PartitionSpec>>&
0 commit comments