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



##########
File path: 
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/SegmentNameGenerator.java
##########
@@ -27,6 +27,7 @@
  * Interface for segment name generator based on the segment sequence id and 
time range.
  */
 public interface SegmentNameGenerator extends Serializable {
+  String INVALID_SEGMENT_NAME_REGEX = ".*[\\\\/:\\*?\"<>|].*";

Review comment:
       I think this regex should be precompiled:
   
   ```java
   Pattern INVALID_SEGMENT_NAME_REGEX = 
Pattern.compile(".*[\\\\/:\\*?\"<>|].*");
   ```
   
   Then the checks become e.g.
   
   ```
   Preconditions.checkArgument(
            segmentNamePrefix != null && ! 
INVALID_SEGMENT_NAME_REGEX.matcher(segmentNamePrefix).matches());
   ```
   
   None of these checks are performance critical, but it makes it easier to use 
static analysis to keep implicit regular expression compilation out of the 
critical path if it's just never used.




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