richardstartin commented on a change in pull request #7776:
URL: https://github.com/apache/pinot/pull/7776#discussion_r750305717



##########
File path: 
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/SimpleSegmentNameGenerator.java
##########
@@ -50,6 +50,12 @@ public SimpleSegmentNameGenerator(String segmentNamePrefix, 
@Nullable String seg
 
   @Override
   public String generateSegmentName(int sequenceId, @Nullable Object 
minTimeValue, @Nullable Object maxTimeValue) {
+    if (minTimeValue != null) {
+      minTimeValue = minTimeValue.toString().replaceAll("[: \\/]", "_");

Review comment:
       It's better to precompile these i.e. 
   
   ```java
   private static final Pattern REPLACEMENT_REGEX = Pattern.compile("[: \\/]");
   
   ...
   
   minTimeValue = minTimeValue.toString().replaceAll(REPLACEMENT_REGEX, "_");
   ```
   
   This isn't a very hot code path but always doing this will make it easier to 
ban on the fly regex compilation with static analysis.




-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to