Copilot commented on code in PR #12327:
URL: https://github.com/apache/gluten/pull/12327#discussion_r3517853016


##########
gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/NexmarkTest.java:
##########
@@ -221,6 +223,29 @@ private static void 
clearEnvironment(StreamTableEnvironment tEnv) {
   private void executeQuery(StreamTableEnvironment tEnv, String queryFileName, 
boolean kafkaSource)
       throws ExecutionException, InterruptedException, TimeoutException {
     String queryContent = readSqlFromFile(NEXMARK_RESOURCE_DIR + "/" + 
queryFileName);
+    // Clean the ORC output directory before running q10_orc to ensure 
deterministic verification.
+    if ("q10_orc.sql".equals(queryFileName)) {
+      Path orcOutputDir = Paths.get("/tmp/data/output/bid_orc");
+      if (Files.exists(orcOutputDir)) {
+        try {
+          try (java.util.stream.Stream<Path> files = Files.walk(orcOutputDir)) 
{
+            files
+                .sorted(java.util.Comparator.reverseOrder())
+                .forEach(
+                    p -> {
+                      try {
+                        Files.deleteIfExists(p);
+                      } catch (IOException e) {
+                        throw new RuntimeException("Failed to delete " + p, e);
+                      }
+                    });
+          }
+        } catch (IOException e) {
+          throw new RuntimeException("Failed to clean ORC output directory", 
e);
+        }
+      }
+    }

Review Comment:
   The cleanup block wraps delete failures into a RuntimeException inside the 
stream lambda, but the outer `catch (IOException e)` will not catch that 
RuntimeException. This makes the outer catch partially ineffective and can lead 
to inconsistent error messages depending on where the failure occurs. Catch 
`RuntimeException` as well (or avoid wrapping inside the lambda) so all cleanup 
failures are handled uniformly with the intended context.



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