ccaominh commented on a change in pull request #8465: disallow whitespace 
characters in data source names
URL: https://github.com/apache/incubator-druid/pull/8465#discussion_r320997864
 
 

 ##########
 File path: 
server/src/test/java/org/apache/druid/segment/indexing/DataSchemaTest.java
 ##########
 @@ -324,6 +324,43 @@ public void testEmptyDatasource()
     );
   }
 
+  @Test
+  public void testNewlineDatasource()
+  {
+    Map<String, Object> parser = jsonMapper.convertValue(
+        new StringInputRowParser(
+            new JSONParseSpec(
+                new TimestampSpec("time", "auto", null),
+                new DimensionsSpec(
+                    DimensionsSpec.getDefaultSchemas(ImmutableList.of("time", 
"dimA", "dimB", "col2")),
+                    ImmutableList.of("dimC"),
+                    null
+                ),
+                null,
+                null
+            ),
+            null
+        ), JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT
+    );
+
+    
expectedException.expect(CoreMatchers.instanceOf(IllegalArgumentException.class));
+    expectedException.expectMessage(
+        "dataSource cannot contain the '/n' character."
+    );
+
+    DataSchema schema = new DataSchema(
+        "new\nline\ncharacter",
+        parser,
+        new AggregatorFactory[]{
+            new DoubleSumAggregatorFactory("metric1", "col1"),
+            new DoubleSumAggregatorFactory("metric2", "col2"),
+            },
+        new ArbitraryGranularitySpec(Granularities.DAY, 
ImmutableList.of(Intervals.of("2014/2015"))),
 
 Review comment:
   Could also pass in `null` for `granularitySpec` to simplify the test code

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to