Skip to content

Commit

Permalink
Replace deprecated usage for StringInputRowParser and JSONParseSpec (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
HyukjinKwon authored and drcrallen committed Jul 14, 2016
1 parent a1715c8 commit 55e7a52
Show file tree
Hide file tree
Showing 19 changed files with 92 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public LineIterator apply(String s)
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("x")), null, null),
",",
ImmutableList.of("ts", "x")
)
),
null
);

final FileIteratingFirehose firehose = new FileIteratingFirehose(lineIterators.iterator(), parser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public void testStringInputRowParserSerde() throws Exception
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("foo", "bar")), null, null),
null,
null
)
),
null
);
final ByteBufferInputRowParser parser2 = jsonMapper.readValue(
jsonMapper.writeValueAsBytes(parser),
Expand Down Expand Up @@ -197,7 +198,8 @@ public void testFlattenParse() throws Exception
new DimensionsSpec(null, null, null),
flattenSpec,
null
)
),
null
);

final StringInputRowParser parser2 = jsonMapper.readValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class HadoopyStringInputRowParser implements InputRowParser<Object>

public HadoopyStringInputRowParser(@JsonProperty("parseSpec") ParseSpec parseSpec)
{
this.parser = new StringInputRowParser(parseSpec);
this.parser = new StringInputRowParser(parseSpec, null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ private HadoopDruidIndexerConfig makeHadoopDruidIndexerConfig(Map<String, Object
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("host")), null, null),
null,
ImmutableList.of("timestamp", "host", "host2", "visited_num")
)
),
null
),
Map.class
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public DetermineHashedPartitionsJobTest(String dataFilePath, long targetPartitio
"placementish",
"index"
)
)
),
null
),
Map.class
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ public DeterminePartitionsJobTest(
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("host", "country")), null, null),
null,
ImmutableList.of("timestamp", "host", "country", "visited_num")
)
),
null
),
Map.class
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public void setUp() throws Exception
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("host")), null, null),
null,
ImmutableList.of("timestamp", "host", "visited")
)
),
null
),
Map.class
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ public static Collection<Object[]> constructFeed()
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("host")), null, null),
null,
ImmutableList.of("timestamp", "host", "visited_num")
)
),
null
),
null,
aggs1,
Expand Down Expand Up @@ -233,7 +234,8 @@ public static Collection<Object[]> constructFeed()
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("host")), null, null),
null,
ImmutableList.of("timestamp", "host", "visited_num")
)
),
null
),
null,
aggs1,
Expand Down Expand Up @@ -316,8 +318,11 @@ public static Collection<Object[]> constructFeed()
new StringInputRowParser(
new JSONParseSpec(
new TimestampSpec("ts", "yyyyMMddHH", null),
new DimensionsSpec(null, null, null)
)
new DimensionsSpec(null, null, null),
null,
null
),
null
),
1, // force 1 row max per index for easier testing
aggs2,
Expand Down Expand Up @@ -345,8 +350,11 @@ public static Collection<Object[]> constructFeed()
new StringInputRowParser(
new JSONParseSpec(
new TimestampSpec("ts", "yyyyMMddHH", null),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("B", "F", "M", "Q", "X", "Y")), null, null)
)
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("B", "F", "M", "Q", "X", "Y")), null, null),
null,
null
),
null
),
1, // force 1 row max per index for easier testing
aggs2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public void setup() throws Exception
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("host")), null, null),
null,
ImmutableList.of("timestamp", "host", "visited_num")
)
),
null
),
Map.class
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ private HadoopDruidIndexerConfig makeHadoopDruidIndexerConfig()
new DimensionsSpec(null, null, null),
null,
ImmutableList.of("timestamp", "host", "visited")
)
),
null
),
Map.class
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ public InputStream openStream() throws IOException
"\t",
"\u0001",
Arrays.asList(TestIndex.COLUMNS)
)
),
null
),
Map.class
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ public void testDeterminePartitions() throws Exception
),
null,
Arrays.asList("ts", "dim", "val")
)
),
null
),
Map.class
),
Expand Down Expand Up @@ -189,7 +190,8 @@ public void testWithArbitraryGranularity() throws Exception
),
null,
Arrays.asList("ts", "dim", "val")
)
),
null
),
Map.class
),
Expand Down Expand Up @@ -302,7 +304,8 @@ public void testIntervalBucketing() throws Exception
),
null,
Arrays.asList("ts", "dim", "val")
)
),
null
),
Map.class
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ public List<StorageLocationConfig> getLocations()
DimensionsSpec.getDefaultSchemas(ImmutableList.<String>of()),
ImmutableList.of(DIM_FLOAT_NAME, DIM_LONG_NAME),
ImmutableList.<SpatialDimensionSchema>of()
)
),
null,
null
)
)
)) {
Expand Down Expand Up @@ -416,7 +418,9 @@ public IngestSegmentFirehoseFactoryTest(
DimensionsSpec.getDefaultSchemas(ImmutableList.of(DIM_NAME)),
ImmutableList.of(DIM_FLOAT_NAME, DIM_LONG_NAME),
ImmutableList.<SpatialDimensionSchema>of()
)
),
null,
null
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ public class IngestSegmentFirehoseFactoryTimelineTest
DimensionsSpec.getDefaultSchemas(Arrays.asList(DIMENSIONS)),
null,
null
)
),
null,
null
)
);

Expand Down
25 changes: 18 additions & 7 deletions server/src/test/java/io/druid/segment/indexing/DataSchemaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ public void testDefaultExclusions() throws Exception
new StringInputRowParser(
new JSONParseSpec(
new TimestampSpec("time", "auto", null),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("dimB", "dimA")), null, null)
)
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("dimB", "dimA")), null, null),
null,
null
),
null
), new TypeReference<Map<String, Object>>() {}
);

Expand Down Expand Up @@ -87,8 +90,11 @@ public void testExplicitInclude() throws Exception
new StringInputRowParser(
new JSONParseSpec(
new TimestampSpec("time", "auto", null),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("time", "dimA", "dimB", "col2")), ImmutableList.of("dimC"), null)
)
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("time", "dimA", "dimB", "col2")), ImmutableList.of("dimC"), null),
null,
null
),
null
), new TypeReference<Map<String, Object>>() {}
);

Expand Down Expand Up @@ -116,8 +122,11 @@ public void testOverlapMetricNameAndDim() throws Exception
new StringInputRowParser(
new JSONParseSpec(
new TimestampSpec("time", "auto", null),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("time", "dimA", "dimB", "metric1")), ImmutableList.of("dimC"), null)
)
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("time", "dimA", "dimB", "metric1")), ImmutableList.of("dimC"), null),
null,
null
),
null
), new TypeReference<Map<String, Object>>() {}
);

Expand Down Expand Up @@ -197,7 +206,9 @@ public void testSerde() throws Exception
actual.getParser().getParseSpec(),
new JSONParseSpec(
new TimestampSpec("xXx", null, null),
new DimensionsSpec(null, Arrays.asList("metric1", "xXx", "col1"), null)
new DimensionsSpec(null, Arrays.asList("metric1", "xXx", "col1"), null),
null,
null
)
);
Assert.assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,11 @@ public void testSerde() throws Exception
DimensionsSpec.getDefaultSchemas(Arrays.asList("dim1", "dim2")),
null,
null
)
)
),
null,
null
),
null
),
Map.class
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ public AppenderatorTester(
new MapInputRowParser(
new JSONParseSpec(
new TimestampSpec("ts", "auto", null),
new DimensionsSpec(null, null, null)
new DimensionsSpec(null, null, null),
null,
null
)
),
Map.class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public void setUp() throws Exception
"timestamp",
"auto",
null
), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("d1")), null, null)
), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("d1")), null, null),
null,
null
)
)
);
Expand Down Expand Up @@ -213,7 +215,9 @@ public void testDuplicateRegistering() throws IOException
"timestamp",
"auto",
null
), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("d1")), null, null)
), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("d1")), null, null),
null,
null
)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ public void setUp() throws Exception
new StringInputRowParser(
new JSONParseSpec(
new TimestampSpec("timestamp", "auto", null),
new DimensionsSpec(null, null, null)
)
new DimensionsSpec(null, null, null),
null,
null
),
null
),
Map.class
),
Expand All @@ -151,8 +154,11 @@ public void setUp() throws Exception
new StringInputRowParser(
new JSONParseSpec(
new TimestampSpec("timestamp", "auto", null),
new DimensionsSpec(null, null, null)
)
new DimensionsSpec(null, null, null),
null,
null
),
null
),
Map.class
),
Expand Down

0 comments on commit 55e7a52

Please sign in to comment.