Skip to content

Commit

Permalink
Remove unnecessary ImmutableMap builder use
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Jan 18, 2022
1 parent c0276ce commit 3e06ac2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ public void testMixedArray()

createIndex(indexName, mapping);

index(indexName, ImmutableMap.<String, Object>builder().buildOrThrow());
index(indexName, ImmutableMap.of());

index(indexName, ImmutableMap.<String, Object>builder()
.put("a", "hello")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ protected QueryRunner createQueryRunner()

QueryRunner queryRunner = KafkaQueryRunner.builder(testingKafka)
.setTables(TpchTable.getTables())
.setExtraTopicDescription(ImmutableMap.<SchemaTableName, KafkaTopicDescription>builder()
.putAll(extraTopicDescriptions)
.buildOrThrow())
.setExtraTopicDescription(extraTopicDescriptions)
.build();

return queryRunner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,15 @@ private void checkFieldType(int field, Type expected)
private List<PrometheusStandardizedRow> prometheusResultsInStandardizedForm(List<PrometheusMetricResult> results)
{
return results.stream().map(result ->
result.getTimeSeriesValues().getValues().stream().map(prometheusTimeSeriesValue ->
new PrometheusStandardizedRow(
getBlockFromMap(columnHandles.get(0).getColumnType(), metricHeaderToMap(result.getMetricHeader())),
prometheusTimeSeriesValue.getTimestamp(),
Double.parseDouble(prometheusTimeSeriesValue.getValue())))
result.getTimeSeriesValues().getValues().stream().map(prometheusTimeSeriesValue -> new PrometheusStandardizedRow(
getBlockFromMap(columnHandles.get(0).getColumnType(), ImmutableMap.copyOf(result.getMetricHeader())),
prometheusTimeSeriesValue.getTimestamp(),
Double.parseDouble(prometheusTimeSeriesValue.getValue())))
.collect(Collectors.toList()))
.flatMap(List::stream)
.collect(Collectors.toList());
}

private static Map<String, String> metricHeaderToMap(Map<String, String> mapToConvert)
{
return ImmutableMap.<String, String>builder().putAll(mapToConvert).buildOrThrow();
}

static Block getBlockFromMap(Type mapType, Map<?, ?> map)
{
// on functions like COUNT() the Type won't be a MapType
Expand Down

0 comments on commit 3e06ac2

Please sign in to comment.