FrankChen021 commented on code in PR #20121:
URL: https://github.com/apache/druid/pull/20121#discussion_r3835087227


##########
processing/src/test/java/org/apache/druid/segment/SchemalessIndexTest.java:
##########
@@ -178,45 +183,62 @@
         return mergedIndex;
       }
 
-      try {
-        IncrementalIndex top = makeIncrementalIndex("druid.sample.json.top", 
METRIC_AGGS);
-        IncrementalIndex bottom = 
makeIncrementalIndex("druid.sample.json.bottom", METRIC_AGGS);
+      mergedIndex = createMergedIncrementalIndex();
+      return mergedIndex;
+    }
+  }
 
-        File tmpFile = File.createTempFile("yay", "who");
-        tmpFile.delete();
+  QueryableIndex createMergedIncrementalIndex()
+  {
+    final IncrementalIndex top = makeIncrementalIndex("druid.sample.json.top", 
METRIC_AGGS);
+    final IncrementalIndex bottom = 
makeIncrementalIndex("druid.sample.json.bottom", METRIC_AGGS);
+    QueryableIndex topIndex = null;
+    QueryableIndex bottomIndex = null;
 
-        File topFile = new File(tmpFile, "top");
-        File bottomFile = new File(tmpFile, "bottom");
-        File mergedFile = new File(tmpFile, "merged");
+    try {
+      File tmpFile = File.createTempFile("yay", "who");

Review Comment:
   Addressed in commit `50c17d314f`. I replaced all five 
`File.createTempFile(...); delete(); mkdirp(...)` patterns in 
`SchemalessIndexTest` with Druid's `FileUtils.createTempDir(...)`, which uses 
`Files.createTempDirectory` to create the directory atomically with a unique 
name. This removes the predictable-path/re-created-file issue identified by 
CodeQL. Processing test-compile, the focused schemaless test (37 executions, 36 
active), Checkstyle, SpotBugs, and `git diff --check` all pass.
   
   <!-- mergelens:review -->



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