amogh-jahagirdar commented on code in PR #14660:
URL: https://github.com/apache/iceberg/pull/14660#discussion_r2557275790
##########
core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java:
##########
@@ -763,22 +774,45 @@ static void clearPlanningState() {
* @param tableScan the table scan to plan
* @param planId the unique identifier for this plan
* @param tasksPerPlanTask number of file scan tasks to group per plan task
+ * @return the initial file scan tasks and the first plan task key
*/
- private static void planFilesFor(TableScan tableScan, String planId, int
tasksPerPlanTask) {
+ private static Pair<List<FileScanTask>, String> planFilesFor(
+ TableScan tableScan, String planId, int tasksPerPlanTask) {
Iterable<List<FileScanTask>> taskGroupings =
Iterables.partition(tableScan.planFiles(), tasksPerPlanTask);
+ Iterator<List<FileScanTask>> taskIterator = taskGroupings.iterator();
+ String planTaskKeyPrefix = planId + "-" + tableScan.table().uuid() + "-";
+
+ if (!taskIterator.hasNext()) {
+ // Handle empty table scans
+ String emptyPlanTaskKey = planTaskKeyPrefix + 0;
+ IN_MEMORY_PLANNING_STATE.addPlanTask(emptyPlanTaskKey,
Collections.emptyList());
Review Comment:
Ok this is probably for the async case, in case somehow the async case is
run on an empty table.
--
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]