xiangfu0 commented on code in PR #20457:
URL: https://github.com/apache/pinot/pull/20457#discussion_r4805772186


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotLogicalTableResource.java:
##########
@@ -199,6 +207,26 @@ public SuccessResponse deleteLogicalTable(
     }
   }
 
+  private void authorizePhysicalTables(LogicalTableConfig logicalTableConfig, 
Request request, HttpHeaders headers) {
+    // Adding a physical table to a logical table prevents deletion of that 
physical table while it is referenced.
+    Set<String> physicalTableNames = new 
LinkedHashSet<>(logicalTableConfig.getPhysicalTableConfigMap().keySet());
+    TimeBoundaryConfig boundary = logicalTableConfig.getTimeBoundaryConfig();
+    // The config validator rejects missing strategy names before persisting 
the mapping.
+    if (boundary != null && 
StringUtils.isNotEmpty(boundary.getBoundaryStrategy())) {
+      try {
+        physicalTableNames.addAll(TimeBoundaryStrategyService.getInstance()
+            
.getTimeBoundaryStrategy(boundary.getBoundaryStrategy()).getTimeBoundaryTableNames(logicalTableConfig));
+      } catch (IllegalArgumentException | ClassCastException e) {

Review Comment:
   `getTimeBoundaryTableNames` returns the raw parameter list unchecked, so a 
non-string element in `includedTables` passes `addAll` and the 
`ClassCastException` only surfaces in the loop on line 224, outside this `try`. 
A JSON `null` under the key gives a `NullPointerException` from `addAll`, which 
this clause doesn't catch either. Both come back as 500 rather than the 400 
intended here. Copying the names into the set with an explicit string check 
inside the `try` would keep them a 400.



-- 
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