SQL: Do not compile against matrix aggs module

Since matrix aggs module isn't on the classpath at runtime, we shouldn't
compile with it on the classpath. Doing so makes it possible for us to
die with dignity when we can't load the class. Which happens right now.

Original commit: elastic/x-pack-elasticsearch@6d2ca5e367
This commit is contained in:
Nik Everett 2017-12-18 15:08:18 -05:00
parent 021e8dd111
commit 13428f4217
2 changed files with 4 additions and 5 deletions

View File

@ -4,7 +4,6 @@ dependencies {
compile project(':x-pack-elasticsearch:sql:jdbc-proto') compile project(':x-pack-elasticsearch:sql:jdbc-proto')
compile project(':x-pack-elasticsearch:sql:cli-proto') compile project(':x-pack-elasticsearch:sql:cli-proto')
compile project(':x-pack-elasticsearch:sql:shared-proto') compile project(':x-pack-elasticsearch:sql:shared-proto')
provided "org.elasticsearch.plugin:aggs-matrix-stats-client:${project.versions.elasticsearch}"
compile 'org.antlr:antlr4-runtime:4.5.3' compile 'org.antlr:antlr4-runtime:4.5.3'
provided "org.elasticsearch:elasticsearch:${project.versions.elasticsearch}" provided "org.elasticsearch:elasticsearch:${project.versions.elasticsearch}"

View File

@ -6,10 +6,9 @@
package org.elasticsearch.xpack.sql.querydsl.agg; package org.elasticsearch.xpack.sql.querydsl.agg;
import java.util.List; import java.util.List;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregationBuilder;
import org.elasticsearch.xpack.sql.planner.PlanningException;
import static org.elasticsearch.search.aggregations.MatrixStatsAggregationBuilders.matrixStats;
public class MatrixStatsAgg extends LeafAgg { public class MatrixStatsAgg extends LeafAgg {
@ -18,10 +17,11 @@ public class MatrixStatsAgg extends LeafAgg {
public MatrixStatsAgg(String id, String propertyPath, List<String> fields) { public MatrixStatsAgg(String id, String propertyPath, List<String> fields) {
super(id, propertyPath, "<multi-field>"); super(id, propertyPath, "<multi-field>");
this.fields = fields; this.fields = fields;
throw new PlanningException("innerkey/matrix stats not handled (yet)", RestStatus.BAD_REQUEST);
} }
@Override @Override
AggregationBuilder toBuilder() { AggregationBuilder toBuilder() {
return matrixStats(id()).fields(fields); throw new UnsupportedOperationException();
} }
} }