You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/11/16 14:06:11 UTC

[GitHub] [pinot] richardstartin commented on a change in pull request #7776: Handle segment names that may contain characters typically used in DateTime fields

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-unsubscribe@pinot.apache.org

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



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