This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 5135acb95d refine error msg related to segment name generation to be 
more actionable (#8676)
5135acb95d is described below

commit 5135acb95d336a1b5f45ad6efe2a4b737aee2d33
Author: Xiaobing <61892277+klsi...@users.noreply.github.com>
AuthorDate: Tue May 10 17:16:36 2022 -0700

    refine error msg related to segment name generation to be more actionable 
(#8676)
---
 .../resources/PinotIngestionRestletResource.java   | 20 +++++++++----
 .../creator/name/FixedSegmentNameGenerator.java    |  6 +++-
 .../name/InputFileSegmentNameGenerator.java        | 31 ++++++++++++++------
 .../name/NormalizedDateSegmentNameGenerator.java   | 22 +++++++++------
 .../creator/name/SimpleSegmentNameGenerator.java   | 17 +++++------
 .../name/FixedSegmentNameGeneratorTest.java}       | 33 +++++++++-------------
 .../name/InputFileSegmentNameGeneratorTest.java    |  3 +-
 .../NormalizedDateSegmentNameGeneratorTest.java    | 17 +++++------
 .../name/SimpleSegmentNameGeneratorTest.java       |  1 +
 9 files changed, 90 insertions(+), 60 deletions(-)

diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotIngestionRestletResource.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotIngestionRestletResource.java
index f35ca49160..20e128da14 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotIngestionRestletResource.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotIngestionRestletResource.java
@@ -121,12 +121,16 @@ public class PinotIngestionRestletResource {
       + "\n  \"inputFormat\":\"csv\"," + "\n  
\"recordReader.prop.delimiter\":\"|\"" + "\n}\" " + "\n```")
   public void ingestFromFile(
       @ApiParam(value = "Name of the table to upload the file to", required = 
true) @QueryParam("tableNameWithType")
-          String tableNameWithType, @ApiParam(
-      value = "Batch config Map as json string. Must pass inputFormat, and 
optionally record reader properties. e.g. "
+          String tableNameWithType, @ApiParam(value =
+      "Batch config Map as json string. Must pass inputFormat, and optionally 
record reader properties. e.g. "
           + "{\"inputFormat\":\"json\"}", required = true) 
@QueryParam("batchConfigMapStr") String batchConfigMapStr,
       FormDataMultiPart fileUpload, @Suspended final AsyncResponse 
asyncResponse) {
     try {
       asyncResponse.resume(ingestData(tableNameWithType, batchConfigMapStr, 
new DataPayload(fileUpload)));
+    } catch (IllegalArgumentException e) {
+      asyncResponse.resume(new ControllerApplicationException(LOGGER, String
+          .format("Got illegal argument when ingesting file into table: %s. 
%s", tableNameWithType, e.getMessage()),
+          Response.Status.BAD_REQUEST, e));
     } catch (Exception e) {
       asyncResponse.resume(new ControllerApplicationException(LOGGER,
           String.format("Caught exception when ingesting file into table: %s. 
%s", tableNameWithType, e.getMessage()),
@@ -154,8 +158,8 @@ public class PinotIngestionRestletResource {
   @Consumes(MediaType.MULTIPART_FORM_DATA)
   @Path("/ingestFromURI")
   @Authenticate(AccessType.CREATE)
-  @ApiOperation(value = "Ingest from the given URI",
-      notes = "Creates a segment using file at the given URI and pushes it to 
Pinot. "
+  @ApiOperation(value = "Ingest from the given URI", notes =
+      "Creates a segment using file at the given URI and pushes it to Pinot. "
           + "\n All steps happen on the controller. This API is NOT meant for 
production environments/large input "
           + "files. " + "\nExample usage (query params need encoding):" + 
"\n```"
           + "\ncurl -X POST 
\"http://localhost:9000/ingestFromURI?tableNameWithType=foo_OFFLINE";
@@ -166,13 +170,17 @@ public class PinotIngestionRestletResource {
           + "\n&sourceURIStr=s3://test.bucket/path/to/json/data/data.json\"" + 
"\n```")
   public void ingestFromURI(
       @ApiParam(value = "Name of the table to upload the file to", required = 
true) @QueryParam("tableNameWithType")
-          String tableNameWithType, @ApiParam(
-      value = "Batch config Map as json string. Must pass inputFormat, and 
optionally input FS properties. e.g. "
+          String tableNameWithType, @ApiParam(value =
+      "Batch config Map as json string. Must pass inputFormat, and optionally 
input FS properties. e.g. "
           + "{\"inputFormat\":\"json\"}", required = true) 
@QueryParam("batchConfigMapStr") String batchConfigMapStr,
       @ApiParam(value = "URI of file to upload", required = true) 
@QueryParam("sourceURIStr") String sourceURIStr,
       @Suspended final AsyncResponse asyncResponse) {
     try {
       asyncResponse.resume(ingestData(tableNameWithType, batchConfigMapStr, 
new DataPayload(new URI(sourceURIStr))));
+    } catch (IllegalArgumentException e) {
+      asyncResponse.resume(new ControllerApplicationException(LOGGER, String
+          .format("Got illegal argument when ingesting file into table: %s. 
%s", tableNameWithType, e.getMessage()),
+          Response.Status.BAD_REQUEST, e));
     } catch (Exception e) {
       asyncResponse.resume(new ControllerApplicationException(LOGGER,
           String.format("Caught exception when ingesting file into table: %s. 
%s", tableNameWithType, e.getMessage()),
diff --git 
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/FixedSegmentNameGenerator.java
 
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/FixedSegmentNameGenerator.java
index 61b97d4694..cc4acb0c0b 100644
--- 
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/FixedSegmentNameGenerator.java
+++ 
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/FixedSegmentNameGenerator.java
@@ -21,6 +21,7 @@ package org.apache.pinot.segment.spi.creator.name;
 import com.google.common.base.Preconditions;
 import javax.annotation.Nullable;
 
+
 /**
  * Fixed segment name generator which always returns the fixed segment name.
  */
@@ -29,7 +30,10 @@ public class FixedSegmentNameGenerator implements 
SegmentNameGenerator {
   private final String _segmentName;
 
   public FixedSegmentNameGenerator(String segmentName) {
-    Preconditions.checkArgument(segmentName != null && 
isValidSegmentName(segmentName));
+    Preconditions.checkArgument(segmentName != null, "Missing segmentName for 
FixedSegmentNameGenerator");
+    Preconditions
+        .checkArgument(isValidSegmentName(segmentName), "Invalid segmentName: 
%s for FixedSegmentNameGenerator",
+            segmentName);
     _segmentName = segmentName;
   }
 
diff --git 
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGenerator.java
 
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGenerator.java
index 30f430ea7d..aaf4148c14 100644
--- 
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGenerator.java
+++ 
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGenerator.java
@@ -18,14 +18,17 @@
  */
 package org.apache.pinot.segment.spi.creator.name;
 
+import com.google.common.base.Preconditions;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
 import javax.annotation.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 /**
  * Segment name generator that supports defining the segment name based on the 
input file name and path, via a pattern
  * (matched against the input file URI) and a template (currently only 
supports ${filePathPattern:\N}, where N is the
@@ -39,16 +42,28 @@ public class InputFileSegmentNameGenerator implements 
SegmentNameGenerator {
 
   private static final String PARAMETER_TEMPLATE = "${filePathPattern:\\%d}";
 
-  private Pattern _filePathPattern;
-  private String _segmentNameTemplate;
-  private URI _inputFileUri;
-  private String _segmentName;
+  private final Pattern _filePathPattern;
+  private final String _segmentNameTemplate;
+  private final URI _inputFileUri;
+  private final String _segmentName;
 
-  public InputFileSegmentNameGenerator(String filePathPattern, String 
segmentNameTemplate,
-      String inputFileUri) throws URISyntaxException {
-    _filePathPattern = Pattern.compile(filePathPattern);
+  public InputFileSegmentNameGenerator(String filePathPattern, String 
segmentNameTemplate, String inputFileUri) {
+    Preconditions.checkArgument(filePathPattern != null, "Missing 
filePathPattern for InputFileSegmentNameGenerator");
+    try {
+      _filePathPattern = Pattern.compile(filePathPattern);
+    } catch (PatternSyntaxException e) {
+      throw new IllegalArgumentException(
+          String.format("Invalid filePathPattern: %s for 
InputFileSegmentNameGenerator", filePathPattern), e);
+    }
+    Preconditions
+        .checkArgument(segmentNameTemplate != null, "Missing 
segmentNameTemplate for InputFileSegmentNameGenerator");
     _segmentNameTemplate = segmentNameTemplate;
-    _inputFileUri = new URI(inputFileUri);
+    try {
+      _inputFileUri = new URI(inputFileUri);
+    } catch (URISyntaxException e) {
+      throw new IllegalArgumentException(
+          String.format("Invalid inputFileUri: %s for 
InputFileSegmentNameGenerator", inputFileUri), e);
+    }
     _segmentName = makeSegmentName();
   }
 
diff --git 
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/NormalizedDateSegmentNameGenerator.java
 
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/NormalizedDateSegmentNameGenerator.java
index decbc50b45..dd56d9d166 100644
--- 
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/NormalizedDateSegmentNameGenerator.java
+++ 
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/NormalizedDateSegmentNameGenerator.java
@@ -54,13 +54,15 @@ public class NormalizedDateSegmentNameGenerator implements 
SegmentNameGenerator
       boolean excludeSequenceId, @Nullable String pushType, @Nullable String 
pushFrequency,
       @Nullable DateTimeFormatSpec dateTimeFormatSpec, @Nullable String 
segmentNamePostfix) {
     _segmentNamePrefix = segmentNamePrefix != null ? segmentNamePrefix.trim() 
: tableName;
-    Preconditions.checkArgument(
-        _segmentNamePrefix != null && isValidSegmentName(_segmentNamePrefix));
+    Preconditions
+        .checkArgument(_segmentNamePrefix != null, "Missing segmentNamePrefix 
for NormalizedDateSegmentNameGenerator");
+    Preconditions.checkArgument(isValidSegmentName(_segmentNamePrefix),
+        "Invalid segmentNamePrefix: %s for 
NormalizedDateSegmentNameGenerator", _segmentNamePrefix);
     _excludeSequenceId = excludeSequenceId;
     _appendPushType = "APPEND".equalsIgnoreCase(pushType);
     _segmentNamePostfix = segmentNamePostfix != null ? 
segmentNamePostfix.trim() : null;
-    Preconditions.checkArgument(
-        _segmentNamePostfix == null || 
isValidSegmentName(_segmentNamePostfix));
+    Preconditions.checkArgument(_segmentNamePostfix == null || 
isValidSegmentName(_segmentNamePostfix),
+        "Invalid segmentNamePostfix: %s for 
NormalizedDateSegmentNameGenerator", _segmentNamePostfix);
 
     // Include time info for APPEND push type
     if (_appendPushType) {
@@ -73,13 +75,15 @@ public class NormalizedDateSegmentNameGenerator implements 
SegmentNameGenerator
       _outputSDF.setTimeZone(TimeZone.getTimeZone("UTC"));
 
       // Parse input time format: 'EPOCH'/'TIMESTAMP' or 'SIMPLE_DATE_FORMAT' 
using pattern
-      Preconditions.checkNotNull(dateTimeFormatSpec);
+      Preconditions.checkArgument(dateTimeFormatSpec != null,
+          "Must provide date time format spec for 
NormalizedDateSegmentNameGenerator");
       TimeFormat timeFormat = dateTimeFormatSpec.getTimeFormat();
       if (timeFormat == TimeFormat.EPOCH || timeFormat == 
TimeFormat.TIMESTAMP) {
         _inputTimeUnit = dateTimeFormatSpec.getColumnUnit();
         _inputSDF = null;
       } else {
-        Preconditions.checkNotNull(dateTimeFormatSpec.getSDFPattern(), "Must 
provide pattern for SIMPLE_DATE_FORMAT");
+        Preconditions.checkArgument(dateTimeFormatSpec.getSDFPattern() != null,
+            "Must provide pattern for SIMPLE_DATE_FORMAT for 
NormalizedDateSegmentNameGenerator");
         _inputTimeUnit = null;
         _inputSDF = new SimpleDateFormat(dateTimeFormatSpec.getSDFPattern());
         _inputSDF.setTimeZone(TimeZone.getTimeZone("UTC"));
@@ -97,8 +101,10 @@ public class NormalizedDateSegmentNameGenerator implements 
SegmentNameGenerator
 
     // Include time value for APPEND push type
     if (_appendPushType) {
-      return JOINER.join(_segmentNamePrefix, 
getNormalizedDate(Preconditions.checkNotNull(minTimeValue)),
-          getNormalizedDate(Preconditions.checkNotNull(maxTimeValue)), 
_segmentNamePostfix, sequenceIdInSegmentName);
+      Preconditions.checkArgument(minTimeValue != null, "Missing minTimeValue 
for NormalizedDateSegmentNameGenerator");
+      Preconditions.checkArgument(maxTimeValue != null, "Missing maxTimeValue 
for NormalizedDateSegmentNameGenerator");
+      return JOINER.join(_segmentNamePrefix, getNormalizedDate(minTimeValue), 
getNormalizedDate(maxTimeValue),
+          _segmentNamePostfix, sequenceIdInSegmentName);
     } else {
       return JOINER.join(_segmentNamePrefix, _segmentNamePostfix, 
sequenceIdInSegmentName);
     }
diff --git 
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/SimpleSegmentNameGenerator.java
 
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/SimpleSegmentNameGenerator.java
index 739f7c2f29..5c9455a026 100644
--- 
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/SimpleSegmentNameGenerator.java
+++ 
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/SimpleSegmentNameGenerator.java
@@ -40,20 +40,21 @@ public class SimpleSegmentNameGenerator implements 
SegmentNameGenerator {
   private final String _segmentNamePostfix;
 
   public SimpleSegmentNameGenerator(String segmentNamePrefix, @Nullable String 
segmentNamePostfix) {
-    Preconditions.checkArgument(
-        segmentNamePrefix != null && isValidSegmentName(segmentNamePrefix));
-    Preconditions.checkArgument(
-        segmentNamePostfix == null || isValidSegmentName(segmentNamePostfix));
+    Preconditions.checkArgument(segmentNamePrefix != null, "Missing 
segmentNamePrefix for SimpleSegmentNameGenerator");
+    Preconditions.checkArgument(isValidSegmentName(segmentNamePrefix),
+        "Invalid segmentNamePrefix: %s for SimpleSegmentNameGenerator", 
segmentNamePrefix);
+    Preconditions.checkArgument(segmentNamePostfix == null || 
isValidSegmentName(segmentNamePostfix),
+        "Invalid segmentNamePostfix: %s for SimpleSegmentNameGenerator", 
segmentNamePostfix);
     _segmentNamePrefix = segmentNamePrefix;
     _segmentNamePostfix = segmentNamePostfix;
   }
 
   @Override
   public String generateSegmentName(int sequenceId, @Nullable Object 
minTimeValue, @Nullable Object maxTimeValue) {
-    Preconditions.checkArgument(
-        minTimeValue == null || isValidSegmentName(minTimeValue.toString()));
-    Preconditions.checkArgument(
-        maxTimeValue == null || isValidSegmentName(maxTimeValue.toString()));
+    Preconditions.checkArgument(minTimeValue == null || 
isValidSegmentName(minTimeValue.toString()),
+        "Invalid minTimeValue: %s for SimpleSegmentNameGenerator", 
minTimeValue);
+    Preconditions.checkArgument(maxTimeValue == null || 
isValidSegmentName(maxTimeValue.toString()),
+        "Invalid maxTimeValue: %s for SimpleSegmentNameGenerator", 
maxTimeValue);
     return JOINER
         .join(_segmentNamePrefix, minTimeValue, maxTimeValue, 
_segmentNamePostfix, sequenceId >= 0 ? sequenceId : null);
   }
diff --git 
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/FixedSegmentNameGenerator.java
 
b/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/FixedSegmentNameGeneratorTest.java
similarity index 53%
copy from 
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/FixedSegmentNameGenerator.java
copy to 
pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/FixedSegmentNameGeneratorTest.java
index 61b97d4694..2205e379e5 100644
--- 
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/name/FixedSegmentNameGenerator.java
+++ 
b/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/FixedSegmentNameGeneratorTest.java
@@ -18,28 +18,23 @@
  */
 package org.apache.pinot.segment.spi.creator.name;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nullable;
+import org.testng.Assert;
+import org.testng.annotations.Test;
 
-/**
- * Fixed segment name generator which always returns the fixed segment name.
- */
-@SuppressWarnings("serial")
-public class FixedSegmentNameGenerator implements SegmentNameGenerator {
-  private final String _segmentName;
+import static org.testng.Assert.assertEquals;
 
-  public FixedSegmentNameGenerator(String segmentName) {
-    Preconditions.checkArgument(segmentName != null && 
isValidSegmentName(segmentName));
-    _segmentName = segmentName;
-  }
 
-  @Override
-  public String generateSegmentName(int sequenceId, @Nullable Object 
minTimeValue, @Nullable Object maxTimeValue) {
-    return _segmentName;
-  }
+public class FixedSegmentNameGeneratorTest {
 
-  @Override
-  public String toString() {
-    return String.format("FixedSegmentNameGenerator: segmentName=%s", 
_segmentName);
+  @Test
+  public void testWithMalFormedSegmentName() {
+    assertEquals(new FixedSegmentNameGenerator("seg01").generateSegmentName(0, 
null, null), "seg01");
+    try {
+      new FixedSegmentNameGenerator("seg*01").generateSegmentName(0, null, 
null);
+      Assert.fail();
+    } catch (IllegalArgumentException e) {
+      // Expected
+      assertEquals(e.getMessage(), "Invalid segmentName: seg*01 for 
FixedSegmentNameGenerator");
+    }
   }
 }
diff --git 
a/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGeneratorTest.java
 
b/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGeneratorTest.java
index b3a08efa51..7ce23d83f0 100644
--- 
a/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGeneratorTest.java
+++ 
b/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/InputFileSegmentNameGeneratorTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.pinot.segment.spi.creator.name;
 
-import java.net.URISyntaxException;
 import org.testng.annotations.Test;
 
 import static org.testng.Assert.assertEquals;
@@ -57,7 +56,7 @@ public class InputFileSegmentNameGeneratorTest {
           "InputFileSegmentNameGenerator: filePathPattern=%s, 
segmentNameTemplate=%s, inputFileUri=%s, segmentName=%s",
           pattern, template, inputFileUriAsStr, segmentName);
       assertEquals(segmentNameGenerator.toString(), msg);
-    } catch (URISyntaxException e) {
+    } catch (IllegalArgumentException e) {
       fail("Exception thrown while creating URI for " + inputFileUriAsStr);
     }
   }
diff --git 
a/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/NormalizedDateSegmentNameGeneratorTest.java
 
b/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/NormalizedDateSegmentNameGeneratorTest.java
index 535a9fda5d..3316929502 100644
--- 
a/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/NormalizedDateSegmentNameGeneratorTest.java
+++ 
b/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/NormalizedDateSegmentNameGeneratorTest.java
@@ -232,16 +232,16 @@ public class NormalizedDateSegmentNameGeneratorTest {
       // Expected
     }
     try {
-      new NormalizedDateSegmentNameGenerator(
-          TABLE_NAME, MALFORMED_SEGMENT_NAME_PREFIX, false, APPEND_PUSH_TYPE, 
DAILY_PUSH_FREQUENCY,
+      new NormalizedDateSegmentNameGenerator(TABLE_NAME, 
MALFORMED_SEGMENT_NAME_PREFIX, false, APPEND_PUSH_TYPE,
+          DAILY_PUSH_FREQUENCY,
           new DateTimeFormatSpec(1, TimeUnit.DAYS.toString(), 
SIMPLE_DATE_TIME_FORMAT, STRING_SLASH_DATE_FORMAT), null);
       Assert.fail();
     } catch (IllegalArgumentException e) {
       // Expected
     }
     try {
-      new NormalizedDateSegmentNameGenerator(
-          TABLE_NAME, SEGMENT_NAME_PREFIX, false, APPEND_PUSH_TYPE, 
DAILY_PUSH_FREQUENCY,
+      new NormalizedDateSegmentNameGenerator(TABLE_NAME, SEGMENT_NAME_PREFIX, 
false, APPEND_PUSH_TYPE,
+          DAILY_PUSH_FREQUENCY,
           new DateTimeFormatSpec(1, TimeUnit.DAYS.toString(), 
SIMPLE_DATE_TIME_FORMAT, STRING_SLASH_DATE_FORMAT),
           MALFORMED_SEGMENT_NAME_POSTFIX);
       Assert.fail();
@@ -250,19 +250,20 @@ public class NormalizedDateSegmentNameGeneratorTest {
     }
   }
 
-  @Test
+  @Test(expectedExceptions = IllegalArgumentException.class, 
expectedExceptionsMessageRegExp = "Missing minTimeValue"
+      + " for NormalizedDateSegmentNameGenerator")
   public void testMalFormedDateFormatAndTimeValue() {
     SegmentNameGenerator segmentNameGenerator =
         new NormalizedDateSegmentNameGenerator(TABLE_NAME, null, false, 
APPEND_PUSH_TYPE, DAILY_PUSH_FREQUENCY,
             new DateTimeFormatSpec(1, TimeUnit.DAYS.toString(), 
SIMPLE_DATE_TIME_FORMAT, STRING_SLASH_DATE_FORMAT),
             null);
-    assertEquals(segmentNameGenerator.toString(),
-        "NormalizedDateSegmentNameGenerator: segmentNamePrefix=myTable, "
-            + "appendPushType=true, outputSDF=yyyy-MM-dd, 
inputSDF=yyyy/MM/dd");
+    assertEquals(segmentNameGenerator.toString(), 
"NormalizedDateSegmentNameGenerator: segmentNamePrefix=myTable, "
+        + "appendPushType=true, outputSDF=yyyy-MM-dd, inputSDF=yyyy/MM/dd");
     assertEquals(segmentNameGenerator.generateSegmentName(INVALID_SEQUENCE_ID, 
"1970/01/02", "1970/01/04"),
         "myTable_1970-01-02_1970-01-04");
     assertEquals(segmentNameGenerator.generateSegmentName(VALID_SEQUENCE_ID, 
"1970/01/02", "1970/01/04"),
         "myTable_1970-01-02_1970-01-04_1");
+    segmentNameGenerator.generateSegmentName(VALID_SEQUENCE_ID, null, 
"1970/01/04");
   }
 
   @Test
diff --git 
a/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/SimpleSegmentNameGeneratorTest.java
 
b/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/SimpleSegmentNameGeneratorTest.java
index a80fa3ae61..5bf336a91a 100644
--- 
a/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/SimpleSegmentNameGeneratorTest.java
+++ 
b/pinot-segment-spi/src/test/java/org/apache/pinot/segment/spi/creator/name/SimpleSegmentNameGeneratorTest.java
@@ -80,6 +80,7 @@ public class SimpleSegmentNameGeneratorTest {
       Assert.fail();
     } catch (IllegalArgumentException e) {
       // Expected
+      assertEquals(e.getMessage(), "Invalid maxTimeValue: 12|34 for 
SimpleSegmentNameGenerator");
     }
   }
 }


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

Reply via email to