From 53cde65ab2bfbec9fd78aed242a5d10894b1d4b7 Mon Sep 17 00:00:00 2001 From: Peng Huo Date: Thu, 8 Sep 2022 12:01:00 -0700 Subject: [PATCH] Fix compile issue, add geo module as dependency (#808) * Fix compile issue, add geo module as dependency Signed-off-by: penghuo --- legacy/build.gradle | 2 ++ .../sql/legacy/executor/csv/CSVResultsExtractor.java | 2 +- .../org/opensearch/sql/legacy/query/maker/AggMaker.java | 9 +++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/legacy/build.gradle b/legacy/build.gradle index f605ced7ba..db9d6138f0 100644 --- a/legacy/build.gradle +++ b/legacy/build.gradle @@ -92,6 +92,8 @@ dependencies { implementation group: 'org.json', name: 'json', version:'20180813' implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10' implementation group: 'org.opensearch', name: 'opensearch', version: "${opensearch_version}" + // add geo module as dependency. https://github.com/opensearch-project/OpenSearch/pull/4180/. + implementation group: 'org.opensearch.plugin', name: 'geo', version: "${opensearch_version}" api project(':sql') api project(':common') api project(':opensearch') diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/executor/csv/CSVResultsExtractor.java b/legacy/src/main/java/org/opensearch/sql/legacy/executor/csv/CSVResultsExtractor.java index 5a16a9ab61..70cdd91452 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/executor/csv/CSVResultsExtractor.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/executor/csv/CSVResultsExtractor.java @@ -21,7 +21,7 @@ import org.opensearch.search.aggregations.bucket.MultiBucketsAggregation; import org.opensearch.search.aggregations.bucket.SingleBucketAggregation; import org.opensearch.search.aggregations.metrics.ExtendedStats; -import org.opensearch.search.aggregations.metrics.GeoBounds; +import org.opensearch.geo.search.aggregations.metrics.GeoBounds; import org.opensearch.search.aggregations.metrics.NumericMetricsAggregation; import org.opensearch.search.aggregations.metrics.Percentile; import org.opensearch.search.aggregations.metrics.Percentiles; diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/query/maker/AggMaker.java b/legacy/src/main/java/org/opensearch/sql/legacy/query/maker/AggMaker.java index b56692e453..87125721c0 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/query/maker/AggMaker.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/query/maker/AggMaker.java @@ -25,6 +25,7 @@ import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.json.JsonXContent; import org.opensearch.common.xcontent.json.JsonXContentParser; +import org.opensearch.geo.search.aggregations.bucket.geogrid.GeoHashGridAggregationBuilder; import org.opensearch.join.aggregations.JoinAggregationBuilders; import org.opensearch.script.Script; import org.opensearch.script.ScriptType; @@ -34,7 +35,7 @@ import org.opensearch.search.aggregations.BucketOrder; import org.opensearch.search.aggregations.InternalOrder; import org.opensearch.search.aggregations.bucket.filter.FilterAggregationBuilder; -import org.opensearch.search.aggregations.bucket.geogrid.GeoGridAggregationBuilder; +import org.opensearch.geo.search.aggregations.bucket.geogrid.GeoGridAggregationBuilder; import org.opensearch.search.aggregations.bucket.histogram.DateHistogramAggregationBuilder; import org.opensearch.search.aggregations.bucket.histogram.DateHistogramInterval; import org.opensearch.search.aggregations.bucket.histogram.HistogramAggregationBuilder; @@ -44,7 +45,7 @@ import org.opensearch.search.aggregations.bucket.range.RangeAggregationBuilder; import org.opensearch.search.aggregations.bucket.terms.IncludeExclude; import org.opensearch.search.aggregations.bucket.terms.TermsAggregationBuilder; -import org.opensearch.search.aggregations.metrics.GeoBoundsAggregationBuilder; +import org.opensearch.geo.search.aggregations.metrics.GeoBoundsAggregationBuilder; import org.opensearch.search.aggregations.metrics.PercentilesAggregationBuilder; import org.opensearch.search.aggregations.metrics.ScriptedMetricAggregationBuilder; import org.opensearch.search.aggregations.metrics.TopHitsAggregationBuilder; @@ -285,7 +286,7 @@ private AggregationBuilder makeRangeGroup(MethodField field) throws SqlParseExce private AggregationBuilder geoBounds(MethodField field) throws SqlParseException { String aggName = gettAggNameFromParamsOrAlias(field); - GeoBoundsAggregationBuilder boundsBuilder = AggregationBuilders.geoBounds(aggName); + GeoBoundsAggregationBuilder boundsBuilder = new GeoBoundsAggregationBuilder(aggName); String value; for (KVValue kv : field.getParams()) { value = kv.value.toString(); @@ -472,7 +473,7 @@ private AbstractAggregationBuilder scriptedMetric(MethodField field) throws SqlP private AggregationBuilder geohashGrid(MethodField field) throws SqlParseException { String aggName = gettAggNameFromParamsOrAlias(field); - GeoGridAggregationBuilder geoHashGrid = AggregationBuilders.geohashGrid(aggName); + GeoGridAggregationBuilder geoHashGrid = new GeoHashGridAggregationBuilder(aggName); String value; for (KVValue kv : field.getParams()) { value = kv.value.toString();