jihoonson commented on code in PR #12428:
URL: https://github.com/apache/druid/pull/12428#discussion_r848642727
##########
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionMultiPhaseParallelIndexingWithNullColumnTest.java:
##########
@@ -165,37 +335,105 @@ public void
testIngestNullColumn_storeEmptyColumnsOff_shouldNotStoreEmptyColumns
Set<DataSegment> segments =
getIndexingServiceClient().getPublishedSegments(task);
Assert.assertFalse(segments.isEmpty());
+ final List<DimensionSchema> expectedDimensions =
DimensionsSpec.getDefaultSchemas(
+ Collections.singletonList("ts")
+ );
for (DataSegment segment : segments) {
- Assert.assertFalse(segment.getDimensions().contains("unknownDim"));
+ Assert.assertEquals(expectedDimensions.size(),
segment.getDimensions().size());
+ for (int i = 0; i < expectedDimensions.size(); i++) {
+ Assert.assertEquals(expectedDimensions.get(i).getName(),
segment.getDimensions().get(i));
+ }
}
}
private InputSource getInputSource() throws JsonProcessingException
{
final ObjectMapper mapper = getObjectMapper();
- final List<Map<String, Object>> rows = ImmutableList.of(
- ImmutableMap.of(
- "ts", "2022-01-01",
- "dim1", "val1",
- "dim2", "val11"
- ),
- ImmutableMap.of(
- "ts", "2022-01-02",
- "dim1", "val2",
- "dim2", "val12"
- ),
- ImmutableMap.of(
- "ts", "2022-01-03",
- "dim1", "val3",
- "dim2", "val13"
- )
- );
+ final List<Map<String, Object>> rows = new ArrayList<>();
+ Map<String, Object> row;
+ for (int i = 0; i < 3; i++) {
+ row = new HashMap<>();
+ row.put("ts", StringUtils.format("2022-01-%02d", i + 1));
+ for (int j = 0; j < 2; j++) {
+ row.put("dim" + (j + 1), "val" + (j + 1));
+ }
+ row.put("dim3", null);
+ rows.add(row);
+ }
+ row = new HashMap<>();
+ row.put("ts", "2022-01-04");
+ row.put("dim1", null);
+ row.put("dim2", null);
+ row.put("dim3", null);
+ row.put("nested", ImmutableMap.of("k", "v"));
+ rows.add(row);
final String data = StringUtils.format(
- "%s\n%s\n%s\n",
+ "%s\n%s\n%s\n%s\n",
mapper.writeValueAsString(rows.get(0)),
mapper.writeValueAsString(rows.get(1)),
- mapper.writeValueAsString(rows.get(2))
+ mapper.writeValueAsString(rows.get(2)),
+ mapper.writeValueAsString(rows.get(3))
);
- return new InlineInputSource(data);
+
+ return new SplittableInlineDataSource(ImmutableList.of(data));
+ }
+
+ /**
+ * Splittable inlineDataSource to run tests with range partitioning which
requires the inputSource to be splittable.
+ */
+ private static final class SplittableInlineDataSource implements
SplittableInputSource<String>
+ {
+ private final List<String> data;
+
+ @JsonCreator
Review Comment:
`AbstractParallelIndexSupervisorTaskTest` provides a semi-integration
testing environment. [It serializes and deserializes the given
task](https://github.com/apache/druid/blob/master/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/AbstractParallelIndexSupervisorTaskTest.java#L588-L589)
to mimic the actual task processing.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]