Skip to content

Commit 254f2e0

Browse files
authored
Opendistro Release 1.9.0 (opendistro-for-elasticsearch#532)
* prepare odfe 1.9 * Fix all ES 7.8 compile and build errors * Revert changes as Lombok is working now * Update CustomExternalTestCluster.java * Fix license headers check * Use splitFieldsByMetadata to separate fields when calling SearchHit constructor * More fixes for ODFE 1.9 * Remove todo statement * Add ODFE 1.9.0 release notes
1 parent fb2ed91 commit 254f2e0

30 files changed

+192
-128
lines changed

build.gradle

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
buildscript {
1717
ext {
18-
es_version = "7.7.0"
18+
es_version = "7.8.0"
1919
}
2020
// This isn't applying from repositories.gradle so repeating it here
2121
repositories {
@@ -40,7 +40,7 @@ repositories {
4040
}
4141

4242
ext {
43-
opendistroVersion = '1.8.0'
43+
opendistroVersion = '1.9.0'
4444
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
4545
}
4646

@@ -97,6 +97,10 @@ licenseHeaders {
9797
excludes = ['com/amazon/opendistroforelasticsearch/sql/antlr/parser/**']
9898
}
9999

100+
tasks.withType(licenseHeaders.class) {
101+
additionalLicense 'AL ', 'Apache', 'Licensed under the Apache License, Version 2.0 (the "License")'
102+
}
103+
100104
// TODO: need to fix java doc to enable JavaDoc
101105
javadoc.enabled = false
102106
esplugin {
@@ -272,14 +276,16 @@ dependencies {
272276
testCompile group: "org.elasticsearch.client", name: 'transport', version: "${es_version}"
273277

274278
// JDBC drivers for comparison test. Somehow Apache Derby throws security permission exception.
275-
testCompile group: 'com.amazon.opendistroforelasticsearch.client', name: 'opendistro-sql-jdbc', version: '1.3.0.0'
279+
testCompile group: 'com.amazon.opendistroforelasticsearch.client', name: 'opendistro-sql-jdbc', version: '1.8.0.0'
276280
testCompile group: 'com.h2database', name: 'h2', version: '1.4.200'
277281
testCompile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.28.0'
278282
//testCompile group: 'org.apache.derby', name: 'derby', version: '10.15.1.3'
279283
}
280284

281285
apply plugin: 'nebula.ospackage'
282286

287+
validateNebulaPom.enabled = false
288+
283289
// This is afterEvaluate because the bundlePlugin ZIP task is updated afterEvaluate and changes the ZIP name to match the plugin name
284290
afterEvaluate {
285291
ospackage {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# permissions and limitations under the License.
1414
#
1515

16-
version=1.8.0
16+
version=1.9.0

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# permissions and limitations under the License.
1414
#
1515

16-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-all.zip
16+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
1717
distributionBase=GRADLE_USER_HOME
1818
distributionPath=wrapper/dists
1919
zipStorePath=wrapper/dists
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## 2020-06-23 Version 1.9.0.0
2+
3+
### Features
4+
#### Elasticsearch Compatibility
5+
* Feature [#532](https://github.com/opendistro-for-elasticsearch/sql/pull/532): Elasticsearch 7.8.0 compatibility (issue: [#531](https://github.com/opendistro-for-elasticsearch/sql/issues/531))
6+
7+
#### Documentation
8+
* Feature [#486](https://github.com/opendistro-for-elasticsearch/sql/pull/486): Add Github badges to README
9+
10+
### Enhancements
11+
#### SQL Features
12+
* Feature [#473](https://github.com/opendistro-for-elasticsearch/sql/pull/473): Support Integration Tests for Security enabled ODFE cluster
13+
14+
### Bugfixes
15+
* Bugfix [#489](https://github.com/opendistro-for-elasticsearch/sql/pull/489): Fix ANTLR grammar for negative integer and floating point number (issue: [#488](https://github.com/opendistro-for-elasticsearch/sql/issues/488))
16+
* Bugfix [#522](https://github.com/opendistro-for-elasticsearch/sql/pull/522): Bug fix, support long type for aggregation (issue: [#521](https://github.com/opendistro-for-elasticsearch/sql/issues/521))

src/main/java/com/amazon/opendistroforelasticsearch/sql/esdomain/LocalClusterState.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ public void setClusterService(ClusterService clusterService) {
109109
this.clusterService = clusterService;
110110

111111
clusterService.addListener(event -> {
112-
if (event.metaDataChanged()) {
112+
if (event.metadataChanged()) {
113113
// State in cluster service is already changed to event.state() before listener fired
114114
if (LOG.isDebugEnabled()) {
115115
LOG.debug("Metadata in cluster state changed: {}",
116-
new IndexMappings(clusterService.state().metaData()));
116+
new IndexMappings(clusterService.state().metadata()));
117117
}
118118
cache.invalidateAll();
119119
}
@@ -169,8 +169,8 @@ public IndexMappings getFieldMappings(String[] indices, String[] types) {
169169
}
170170

171171
/**
172-
* Get field mappings by index expressions, type and field filter. Because IndexMetaData/MappingMetaData
173-
* is hard to convert to FieldMappingMetaData, custom mapping domain objects are being used here. In future,
172+
* Get field mappings by index expressions, type and field filter. Because IndexMetadata/MappingMetadata
173+
* is hard to convert to FieldMappingMetadata, custom mapping domain objects are being used here. In future,
174174
* it should be moved to domain model layer for all ES specific knowledge.
175175
* <p>
176176
* Note that cluster state may be change inside ES so it's possible to read different state in 2 accesses
@@ -222,7 +222,7 @@ private IndexMappings findMappings(ClusterState state, String[] indices, String[
222222
Function<String, Predicate<String>> fieldFilter) throws IOException {
223223
LOG.debug("Cache didn't help. Load and parse mapping in cluster state");
224224
return new IndexMappings(
225-
state.metaData().findMappings(indices, types, fieldFilter)
225+
state.metadata().findMappings(indices, types, fieldFilter)
226226
);
227227
}
228228

src/main/java/com/amazon/opendistroforelasticsearch/sql/esdomain/mapping/FieldMapping.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.util.Map;
2222

2323
import static java.util.Collections.emptyMap;
24-
import static org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData;
24+
import static org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetadata;
2525

2626
/**
2727
* Field mapping that parses native ES mapping.
@@ -39,7 +39,7 @@ public class FieldMapping {
3939
/**
4040
* Native mapping information returned from ES
4141
*/
42-
private final Map<String, FieldMappingMetaData> typeMappings;
42+
private final Map<String, FieldMappingMetadata> typeMappings;
4343

4444
/**
4545
* Maps a field name to Field object that specified in query explicitly
@@ -51,7 +51,7 @@ public FieldMapping(String fieldName) {
5151
}
5252

5353
public FieldMapping(String fieldName,
54-
Map<String, FieldMappingMetaData> typeMappings,
54+
Map<String, FieldMappingMetadata> typeMappings,
5555
Map<String, Field> specifiedFieldByNames) {
5656

5757
this.fieldName = fieldName;
@@ -119,16 +119,16 @@ public String path() {
119119
}
120120

121121
/**
122-
* Used to retrieve the type of fields from metaData map structures for both regular and nested fields
122+
* Used to retrieve the type of fields from metadata map structures for both regular and nested fields
123123
*/
124124
@SuppressWarnings("unchecked")
125125
public String type() {
126-
FieldMappingMetaData metaData = typeMappings.get(fieldName);
127-
Map<String, Object> source = metaData.sourceAsMap();
126+
FieldMappingMetadata metadata = typeMappings.get(fieldName);
127+
Map<String, Object> source = metadata.sourceAsMap();
128128
String[] fieldPath = fieldName.split("\\.");
129129

130130
/*
131-
* When field is not nested the metaData source is fieldName -> type
131+
* When field is not nested the metadata source is fieldName -> type
132132
* When it is nested or contains "." in general (ex. fieldName.nestedName) the source is nestedName -> type
133133
*/
134134
String root = (fieldPath.length == 1) ? fieldName : fieldPath[1];

src/main/java/com/amazon/opendistroforelasticsearch/sql/esdomain/mapping/FieldMappings.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
package com.amazon.opendistroforelasticsearch.sql.esdomain.mapping;
1717

18-
import org.elasticsearch.cluster.metadata.MappingMetaData;
18+
import org.elasticsearch.cluster.metadata.MappingMetadata;
1919
import org.json.JSONObject;
2020

2121
import java.util.HashMap;
@@ -61,7 +61,7 @@ public class FieldMappings implements Mappings<Map<String, Object>> {
6161
*/
6262
private final Map<String, Object> fieldMappings;
6363

64-
public FieldMappings(MappingMetaData mappings) {
64+
public FieldMappings(MappingMetadata mappings) {
6565
fieldMappings = mappings.sourceAsMap();
6666
}
6767

src/main/java/com/amazon/opendistroforelasticsearch/sql/esdomain/mapping/IndexMappings.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
package com.amazon.opendistroforelasticsearch.sql.esdomain.mapping;
1717

18-
import org.elasticsearch.cluster.metadata.MappingMetaData;
19-
import org.elasticsearch.cluster.metadata.MetaData;
18+
import org.elasticsearch.cluster.metadata.MappingMetadata;
19+
import org.elasticsearch.cluster.metadata.Metadata;
2020
import org.elasticsearch.common.collect.ImmutableOpenMap;
2121

2222
import java.util.Map;
@@ -55,12 +55,12 @@ public IndexMappings() {
5555
this.indexMappings = emptyMap();
5656
}
5757

58-
public IndexMappings(MetaData metaData) {
59-
this.indexMappings = buildMappings(metaData.indices(),
60-
indexMetaData -> new TypeMappings(indexMetaData.getMappings()));
58+
public IndexMappings(Metadata metadata) {
59+
this.indexMappings = buildMappings(metadata.indices(),
60+
indexMetadata -> new TypeMappings(indexMetadata.getMappings()));
6161
}
6262

63-
public IndexMappings(ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings) {
63+
public IndexMappings(ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetadata>> mappings) {
6464
this.indexMappings = buildMappings(mappings, TypeMappings::new);
6565
}
6666

src/main/java/com/amazon/opendistroforelasticsearch/sql/esdomain/mapping/TypeMappings.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
package com.amazon.opendistroforelasticsearch.sql.esdomain.mapping;
1717

18-
import org.elasticsearch.cluster.metadata.MappingMetaData;
18+
import org.elasticsearch.cluster.metadata.MappingMetadata;
1919
import org.elasticsearch.common.collect.ImmutableOpenMap;
2020

2121
import java.util.Map;
@@ -36,7 +36,7 @@ public class TypeMappings implements Mappings<FieldMappings> {
3636
*/
3737
private final Map<String, FieldMappings> typeMappings;
3838

39-
public TypeMappings(ImmutableOpenMap<String, MappingMetaData> mappings) {
39+
public TypeMappings(ImmutableOpenMap<String, MappingMetadata> mappings) {
4040
typeMappings = buildMappings(mappings, FieldMappings::new);
4141
}
4242

src/main/java/com/amazon/opendistroforelasticsearch/sql/executor/AsyncRestExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private void async(Client client, Map<String, String> params, QueryAction queryA
143143

144144
// Preserve context of calling thread to ensure headers of requests are forwarded when running blocking actions
145145
threadPool.schedule(
146-
threadPool.preserveContext(LogUtils.withCurrentContext(runnable)),
146+
LogUtils.withCurrentContext(runnable),
147147
new TimeValue(0L),
148148
SQL_WORKER_THREAD_POOL_NAME
149149
);

0 commit comments

Comments
 (0)