diff --git a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchClient.java b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchClient.java index 3f144969ec6b..427461e04f23 100644 --- a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchClient.java +++ b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchClient.java @@ -100,11 +100,11 @@ public class ElasticsearchClient private final Duration maxRetryTime; @Inject - public ElasticsearchClient(ElasticsearchTableDescriptionProvider descriptions, ElasticsearchConnectorConfig config) + public ElasticsearchClient(ElasticsearchTableDescriptionProvider descriptions, ElasticsearchConfig config) throws IOException { tableDescriptions = requireNonNull(descriptions, "description is null"); - ElasticsearchConnectorConfig configuration = requireNonNull(config, "config is null"); + ElasticsearchConfig configuration = requireNonNull(config, "config is null"); requestTimeout = configuration.getRequestTimeout(); maxAttempts = configuration.getMaxRequestRetries(); maxRetryTime = configuration.getMaxRetryTime(); @@ -464,12 +464,12 @@ public int compare(String left, String right) } } - static TransportClient createTransportClient(ElasticsearchConnectorConfig config, TransportAddress address) + static TransportClient createTransportClient(ElasticsearchConfig config, TransportAddress address) { return createTransportClient(config, address, Optional.empty()); } - static TransportClient createTransportClient(ElasticsearchConnectorConfig config, TransportAddress address, Optional clusterName) + static TransportClient createTransportClient(ElasticsearchConfig config, TransportAddress address, Optional clusterName) { Settings settings; Settings.Builder builder = Settings.builder(); diff --git a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchConnectorConfig.java b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchConfig.java similarity index 83% rename from presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchConnectorConfig.java rename to presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchConfig.java index 1bf23f0b4bf5..e308bf266140 100644 --- a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchConnectorConfig.java +++ b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchConfig.java @@ -30,7 +30,7 @@ import static java.util.concurrent.TimeUnit.SECONDS; @DefunctConfig("elasticsearch.max-hits") -public class ElasticsearchConnectorConfig +public class ElasticsearchConfig { private String defaultSchema = "default"; private File tableDescriptionDirectory = new File("etc/elasticsearch/"); @@ -57,7 +57,7 @@ public File getTableDescriptionDirectory() @Config("elasticsearch.table-description-directory") @ConfigDescription("Directory that contains JSON table description files") - public ElasticsearchConnectorConfig setTableDescriptionDirectory(File tableDescriptionDirectory) + public ElasticsearchConfig setTableDescriptionDirectory(File tableDescriptionDirectory) { this.tableDescriptionDirectory = tableDescriptionDirectory; return this; @@ -71,7 +71,7 @@ public String getDefaultSchema() @Config("elasticsearch.default-schema-name") @ConfigDescription("Default schema name to use") - public ElasticsearchConnectorConfig setDefaultSchema(String defaultSchema) + public ElasticsearchConfig setDefaultSchema(String defaultSchema) { this.defaultSchema = defaultSchema; return this; @@ -86,7 +86,7 @@ public int getScrollSize() @Config("elasticsearch.scroll-size") @ConfigDescription("Scroll batch size") - public ElasticsearchConnectorConfig setScrollSize(int scrollSize) + public ElasticsearchConfig setScrollSize(int scrollSize) { this.scrollSize = scrollSize; return this; @@ -100,7 +100,7 @@ public Duration getScrollTimeout() @Config("elasticsearch.scroll-timeout") @ConfigDescription("Scroll timeout") - public ElasticsearchConnectorConfig setScrollTimeout(Duration scrollTimeout) + public ElasticsearchConfig setScrollTimeout(Duration scrollTimeout) { this.scrollTimeout = scrollTimeout; return this; @@ -114,7 +114,7 @@ public Duration getRequestTimeout() @Config("elasticsearch.request-timeout") @ConfigDescription("Elasticsearch request timeout") - public ElasticsearchConnectorConfig setRequestTimeout(Duration requestTimeout) + public ElasticsearchConfig setRequestTimeout(Duration requestTimeout) { this.requestTimeout = requestTimeout; return this; @@ -128,7 +128,7 @@ public int getMaxRequestRetries() @Config("elasticsearch.max-request-retries") @ConfigDescription("Maximum number of Elasticsearch request retries") - public ElasticsearchConnectorConfig setMaxRequestRetries(int maxRequestRetries) + public ElasticsearchConfig setMaxRequestRetries(int maxRequestRetries) { this.maxRequestRetries = maxRequestRetries; return this; @@ -142,7 +142,7 @@ public Duration getMaxRetryTime() @Config("elasticsearch.max-request-retry-time") @ConfigDescription("Use exponential backoff starting at 1s up to the value specified by this configuration when retrying failed requests") - public ElasticsearchConnectorConfig setMaxRetryTime(Duration maxRetryTime) + public ElasticsearchConfig setMaxRetryTime(Duration maxRetryTime) { this.maxRetryTime = maxRetryTime; return this; @@ -156,7 +156,7 @@ public SearchGuardCertificateFormat getCertificateFormat() @Config("searchguard.ssl.certificate-format") @ConfigDescription("Certificate format") - public ElasticsearchConnectorConfig setCertificateFormat(SearchGuardCertificateFormat certificateFormat) + public ElasticsearchConfig setCertificateFormat(SearchGuardCertificateFormat certificateFormat) { this.certificateFormat = certificateFormat; return this; @@ -170,7 +170,7 @@ public File getPemcertFilepath() @Config("searchguard.ssl.pemcert-filepath") @ConfigDescription("Path to the X.509 node certificate chain") - public ElasticsearchConnectorConfig setPemcertFilepath(File pemcertFilepath) + public ElasticsearchConfig setPemcertFilepath(File pemcertFilepath) { this.pemcertFilepath = pemcertFilepath; return this; @@ -184,7 +184,7 @@ public File getPemkeyFilepath() @Config("searchguard.ssl.pemkey-filepath") @ConfigDescription("Path to the certificates key file") - public ElasticsearchConnectorConfig setPemkeyFilepath(File pemkeyFilepath) + public ElasticsearchConfig setPemkeyFilepath(File pemkeyFilepath) { this.pemkeyFilepath = pemkeyFilepath; return this; @@ -198,7 +198,7 @@ public Optional getPemkeyPassword() @Config("searchguard.ssl.pemkey-password") @ConfigDescription("Key password. Omit this setting if the key has no password.") @ConfigSecuritySensitive - public ElasticsearchConnectorConfig setPemkeyPassword(String pemkeyPassword) + public ElasticsearchConfig setPemkeyPassword(String pemkeyPassword) { this.pemkeyPassword = pemkeyPassword; return this; @@ -212,7 +212,7 @@ public File getPemtrustedcasFilepath() @Config("searchguard.ssl.pemtrustedcas-filepath") @ConfigDescription("Path to the root CA(s) (PEM format)") - public ElasticsearchConnectorConfig setPemtrustedcasFilepath(File pemtrustedcasFilepath) + public ElasticsearchConfig setPemtrustedcasFilepath(File pemtrustedcasFilepath) { this.pemtrustedcasFilepath = pemtrustedcasFilepath; return this; @@ -226,7 +226,7 @@ public File getKeystoreFilepath() @Config("searchguard.ssl.keystore-filepath") @ConfigDescription("Path to the keystore file") - public ElasticsearchConnectorConfig setKeystoreFilepath(File keystoreFilepath) + public ElasticsearchConfig setKeystoreFilepath(File keystoreFilepath) { this.keystoreFilepath = keystoreFilepath; return this; @@ -240,7 +240,7 @@ public Optional getKeystorePassword() @Config("searchguard.ssl.keystore-password") @ConfigDescription("Keystore password") @ConfigSecuritySensitive - public ElasticsearchConnectorConfig setKeystorePassword(String keystorePassword) + public ElasticsearchConfig setKeystorePassword(String keystorePassword) { this.keystorePassword = keystorePassword; return this; @@ -254,7 +254,7 @@ public File getTruststoreFilepath() @Config("searchguard.ssl.truststore-filepath") @ConfigDescription("Path to the truststore file") - public ElasticsearchConnectorConfig setTruststoreFilepath(File truststoreFilepath) + public ElasticsearchConfig setTruststoreFilepath(File truststoreFilepath) { this.truststoreFilepath = truststoreFilepath; return this; @@ -268,7 +268,7 @@ public Optional getTruststorePassword() @Config("searchguard.ssl.truststore-password") @ConfigDescription("Truststore password") @ConfigSecuritySensitive - public ElasticsearchConnectorConfig setTruststorePassword(String truststorePassword) + public ElasticsearchConfig setTruststorePassword(String truststorePassword) { this.truststorePassword = truststorePassword; return this; diff --git a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchConnectorModule.java b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchConnectorModule.java index 58948d03ec2c..4a0e38c47c34 100644 --- a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchConnectorModule.java +++ b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchConnectorModule.java @@ -45,7 +45,7 @@ public void configure(Binder binder) binder.bind(ElasticsearchSplitManager.class).in(Scopes.SINGLETON); binder.bind(ElasticsearchRecordSetProvider.class).in(Scopes.SINGLETON); - configBinder(binder).bindConfig(ElasticsearchConnectorConfig.class); + configBinder(binder).bindConfig(ElasticsearchConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindJsonCodec(ElasticsearchTableDescription.class); @@ -55,7 +55,7 @@ public void configure(Binder binder) @Singleton @Provides - public static ElasticsearchClient createElasticsearchClient(ElasticsearchConnectorConfig config, ElasticsearchTableDescriptionProvider elasticsearchTableDescriptionProvider) + public static ElasticsearchClient createElasticsearchClient(ElasticsearchConfig config, ElasticsearchTableDescriptionProvider elasticsearchTableDescriptionProvider) throws IOException { return new ElasticsearchClient(elasticsearchTableDescriptionProvider, config); diff --git a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchQueryBuilder.java b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchQueryBuilder.java index 7903d30aa8e6..3a393886e9c8 100644 --- a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchQueryBuilder.java +++ b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchQueryBuilder.java @@ -68,7 +68,7 @@ public class ElasticsearchQueryBuilder private final String index; private final String type; - public ElasticsearchQueryBuilder(List columnHandles, ElasticsearchConnectorConfig config, ElasticsearchSplit split, ElasticsearchTableHandle table) + public ElasticsearchQueryBuilder(List columnHandles, ElasticsearchConfig config, ElasticsearchSplit split, ElasticsearchTableHandle table) { requireNonNull(columnHandles, "columnHandles is null"); requireNonNull(config, "config is null"); diff --git a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordCursor.java b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordCursor.java index 517a23ad3cec..f88e3c8eeb5d 100644 --- a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordCursor.java +++ b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordCursor.java @@ -61,7 +61,7 @@ public class ElasticsearchRecordCursor private long totalBytes; private List fields; - public ElasticsearchRecordCursor(List columnHandles, ElasticsearchConnectorConfig config, ElasticsearchSplit split, ElasticsearchTableHandle table) + public ElasticsearchRecordCursor(List columnHandles, ElasticsearchConfig config, ElasticsearchSplit split, ElasticsearchTableHandle table) { requireNonNull(columnHandles, "columnHandle is null"); requireNonNull(config, "config is null"); @@ -286,7 +286,7 @@ private static class SearchHitsIterator private Iterator searchHits; private String scrollId; - SearchHitsIterator(ElasticsearchQueryBuilder queryBuilder, ElasticsearchConnectorConfig config) + SearchHitsIterator(ElasticsearchQueryBuilder queryBuilder, ElasticsearchConfig config) { this.queryBuilder = queryBuilder; this.requestTimeout = config.getRequestTimeout(); diff --git a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordSet.java b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordSet.java index f2f7c57c9a45..95e639fa6b49 100644 --- a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordSet.java +++ b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordSet.java @@ -29,9 +29,9 @@ public class ElasticsearchRecordSet private final List columnTypes; private final ElasticsearchSplit split; private final ElasticsearchTableHandle table; - private final ElasticsearchConnectorConfig config; + private final ElasticsearchConfig config; - public ElasticsearchRecordSet(ElasticsearchSplit split, ElasticsearchTableHandle table, ElasticsearchConnectorConfig config, List columnHandles) + public ElasticsearchRecordSet(ElasticsearchSplit split, ElasticsearchTableHandle table, ElasticsearchConfig config, List columnHandles) { this.split = requireNonNull(split, "split is null"); this.table = requireNonNull(table, "table is null"); diff --git a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordSetProvider.java b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordSetProvider.java index 91216b75959c..6b0012890f16 100644 --- a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordSetProvider.java +++ b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchRecordSetProvider.java @@ -31,10 +31,10 @@ public class ElasticsearchRecordSetProvider implements ConnectorRecordSetProvider { - private final ElasticsearchConnectorConfig config; + private final ElasticsearchConfig config; @Inject - public ElasticsearchRecordSetProvider(ElasticsearchConnectorConfig config) + public ElasticsearchRecordSetProvider(ElasticsearchConfig config) { this.config = requireNonNull(config, "config is null"); } diff --git a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchTableDescriptionProvider.java b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchTableDescriptionProvider.java index 1b2f524dc898..e11a0c16da43 100644 --- a/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchTableDescriptionProvider.java +++ b/presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/ElasticsearchTableDescriptionProvider.java @@ -36,14 +36,14 @@ public class ElasticsearchTableDescriptionProvider private final Map tableDefinitions; @Inject - ElasticsearchTableDescriptionProvider(ElasticsearchConnectorConfig config, JsonCodec codec) + ElasticsearchTableDescriptionProvider(ElasticsearchConfig config, JsonCodec codec) { requireNonNull(config, "config is null"); requireNonNull(codec, "codec is null"); tableDefinitions = createTableDescriptions(config, codec); } - private Map createTableDescriptions(ElasticsearchConnectorConfig config, JsonCodec codec) + private Map createTableDescriptions(ElasticsearchConfig config, JsonCodec codec) { Optional files = listFiles(config.getTableDescriptionDirectory()); diff --git a/presto-elasticsearch/src/test/java/io/prestosql/elasticsearch/ElasticsearchQueryRunner.java b/presto-elasticsearch/src/test/java/io/prestosql/elasticsearch/ElasticsearchQueryRunner.java index 0d3d809308d4..200167901e06 100644 --- a/presto-elasticsearch/src/test/java/io/prestosql/elasticsearch/ElasticsearchQueryRunner.java +++ b/presto-elasticsearch/src/test/java/io/prestosql/elasticsearch/ElasticsearchQueryRunner.java @@ -90,7 +90,7 @@ private static ElasticsearchTableDescriptionProvider createTableDescriptions(Met JsonCodec codec = new CodecSupplier<>(ElasticsearchTableDescription.class, metadata).get(); URL metadataUrl = getResource(ElasticsearchQueryRunner.class, "/queryrunner"); - ElasticsearchConnectorConfig config = new ElasticsearchConnectorConfig() + ElasticsearchConfig config = new ElasticsearchConfig() .setTableDescriptionDirectory(new File(metadataUrl.toURI())) .setDefaultSchema(TPCH_SCHEMA); return new ElasticsearchTableDescriptionProvider(config, codec); diff --git a/presto-elasticsearch/src/test/java/io/prestosql/elasticsearch/TestElasticsearchConnectorConfig.java b/presto-elasticsearch/src/test/java/io/prestosql/elasticsearch/TestElasticsearchConfig.java similarity index 95% rename from presto-elasticsearch/src/test/java/io/prestosql/elasticsearch/TestElasticsearchConnectorConfig.java rename to presto-elasticsearch/src/test/java/io/prestosql/elasticsearch/TestElasticsearchConfig.java index 26914bef57d4..d85e7b2f00b0 100644 --- a/presto-elasticsearch/src/test/java/io/prestosql/elasticsearch/TestElasticsearchConnectorConfig.java +++ b/presto-elasticsearch/src/test/java/io/prestosql/elasticsearch/TestElasticsearchConfig.java @@ -28,12 +28,12 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; -public class TestElasticsearchConnectorConfig +public class TestElasticsearchConfig { @Test public void testDefaults() { - assertRecordedDefaults(recordDefaults(ElasticsearchConnectorConfig.class) + assertRecordedDefaults(recordDefaults(ElasticsearchConfig.class) .setTableDescriptionDirectory(new File("etc/elasticsearch/")) .setDefaultSchema("default") .setScrollSize(1000) @@ -74,7 +74,7 @@ public void testExplicitPropertyMappings() .put("searchguard.ssl.truststore-password", "333333") .build(); - ElasticsearchConnectorConfig expected = new ElasticsearchConnectorConfig() + ElasticsearchConfig expected = new ElasticsearchConfig() .setTableDescriptionDirectory(new File("/etc/elasticsearch/")) .setDefaultSchema("test") .setScrollSize(4000)