diff --git a/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/BaseElasticsearchConnectorTest.java b/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/BaseElasticsearchConnectorTest.java index b41f61b317bf..1169a1007cbf 100644 --- a/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/BaseElasticsearchConnectorTest.java +++ b/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/BaseElasticsearchConnectorTest.java @@ -941,7 +941,7 @@ public void testMixedArray() createIndex(indexName, mapping); - index(indexName, ImmutableMap.builder().buildOrThrow()); + index(indexName, ImmutableMap.of()); index(indexName, ImmutableMap.builder() .put("a", "hello") diff --git a/plugin/trino-kafka/src/test/java/io/trino/plugin/kafka/TestKafkaIntegrationSmokeTest.java b/plugin/trino-kafka/src/test/java/io/trino/plugin/kafka/TestKafkaIntegrationSmokeTest.java index 738f7901a393..1bbe9f8b593d 100644 --- a/plugin/trino-kafka/src/test/java/io/trino/plugin/kafka/TestKafkaIntegrationSmokeTest.java +++ b/plugin/trino-kafka/src/test/java/io/trino/plugin/kafka/TestKafkaIntegrationSmokeTest.java @@ -106,9 +106,7 @@ protected QueryRunner createQueryRunner() QueryRunner queryRunner = KafkaQueryRunner.builder(testingKafka) .setTables(TpchTable.getTables()) - .setExtraTopicDescription(ImmutableMap.builder() - .putAll(extraTopicDescriptions) - .buildOrThrow()) + .setExtraTopicDescription(extraTopicDescriptions) .build(); return queryRunner; diff --git a/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusRecordCursor.java b/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusRecordCursor.java index f0b55c946bc7..6beb1827cebd 100644 --- a/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusRecordCursor.java +++ b/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusRecordCursor.java @@ -185,21 +185,15 @@ private void checkFieldType(int field, Type expected) private List prometheusResultsInStandardizedForm(List 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 metricHeaderToMap(Map mapToConvert) - { - return ImmutableMap.builder().putAll(mapToConvert).buildOrThrow(); - } - static Block getBlockFromMap(Type mapType, Map map) { // on functions like COUNT() the Type won't be a MapType