This is an automated email from the ASF dual-hosted git repository. sereda pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/master by this push: new 4be11a9 Remove usage of 'userConfig' attribute in ElasticSearch adapter 4be11a9 is described below commit 4be11a9e4425674a86192c8a908177df29725af0 Author: Andrei Sereda <25229979+asereda...@users.noreply.github.com> AuthorDate: Tue Feb 5 10:40:23 2019 -0500 Remove usage of 'userConfig' attribute in ElasticSearch adapter `userConfig` is not used since migration to ES RestClient (it is ignored by ElasticsearchSchemaFactory) --- .../elasticsearch/ElasticsearchSchemaFactory.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java b/elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java index 5493f76..7939457 100644 --- a/elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java +++ b/elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java @@ -55,18 +55,18 @@ public class ElasticsearchSchemaFactory implements SchemaFactory { mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); try { - final Map<String, Integer> coordinates = - mapper.readValue((String) map.get("coordinates"), - new TypeReference<Map<String, Integer>>() { }); + final String coordinatesString = (String) map.get("coordinates"); + Preconditions.checkState(coordinatesString != null, + "'coordinates' is missing in configuration"); - final RestClient client = connect(coordinates); + final Map<String, Integer> coordinates = mapper.readValue(coordinatesString, + new TypeReference<Map<String, Integer>>() { }); - final Map<String, String> userConfig = - mapper.readValue((String) map.get("userConfig"), - new TypeReference<Map<String, String>>() { }); + // create client + final RestClient client = connect(coordinates); final String index = (String) map.get("index"); - Preconditions.checkArgument(index != null, "index is missing in configuration"); + Preconditions.checkState(index != null, "'index' is missing in configuration"); return new ElasticsearchSchema(client, new ObjectMapper(), index); } catch (IOException e) { throw new RuntimeException("Cannot parse values from json", e);