From 36dca6d1874a6f0f730a9c78ae8b0fa49458c505 Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Thu, 18 Oct 2018 12:38:32 +0200 Subject: [PATCH 01/17] SQL: Implement IN(value1, value2, ...) expression. Implement the functionality to translate the `field IN (value1, value2,...) expressions to proper Lucene queries or painless script depending on the use case. The `IN` expression can be used in SELECT, WHERE and HAVING clauses. Closes: #32955 --- .../xpack/sql/analysis/analyzer/Verifier.java | 40 ++++++- .../xpack/sql/expression/predicate/In.java | 103 +++++++++++++++-- .../operator/comparison/Comparisons.java | 28 +++-- .../predicate/operator/comparison/InPipe.java | 104 ++++++++++++++++++ .../operator/comparison/InProcessor.java | 54 +++++++++ .../xpack/sql/planner/QueryFolder.java | 4 + .../xpack/sql/planner/QueryTranslator.java | 70 ++++++++++-- .../xpack/sql/querydsl/query/TermsQuery.java | 64 +++++++++++ .../analyzer/VerifierErrorMessagesTests.java | 22 +++- .../sql/planner/QueryTranslatorTests.java | 66 ++++++++--- x-pack/qa/sql/src/main/resources/agg.sql-spec | 5 + .../qa/sql/src/main/resources/filter.sql-spec | 16 +++ .../qa/sql/src/main/resources/select.csv-spec | 67 +++++++++++ 13 files changed, 599 insertions(+), 44 deletions(-) create mode 100644 x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InPipe.java create mode 100644 x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java create mode 100644 x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java create mode 100644 x-pack/qa/sql/src/main/resources/select.csv-spec diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java index 4915a25a55bc7..5db07463611f9 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java @@ -12,17 +12,20 @@ import org.elasticsearch.xpack.sql.expression.Expression; import org.elasticsearch.xpack.sql.expression.Expressions; import org.elasticsearch.xpack.sql.expression.FieldAttribute; +import org.elasticsearch.xpack.sql.expression.NamedExpression; import org.elasticsearch.xpack.sql.expression.UnresolvedAttribute; import org.elasticsearch.xpack.sql.expression.function.Function; import org.elasticsearch.xpack.sql.expression.function.FunctionAttribute; import org.elasticsearch.xpack.sql.expression.function.Functions; import org.elasticsearch.xpack.sql.expression.function.Score; import org.elasticsearch.xpack.sql.expression.function.scalar.ScalarFunction; +import org.elasticsearch.xpack.sql.expression.predicate.In; import org.elasticsearch.xpack.sql.plan.logical.Aggregate; import org.elasticsearch.xpack.sql.plan.logical.Distinct; import org.elasticsearch.xpack.sql.plan.logical.Filter; import org.elasticsearch.xpack.sql.plan.logical.LogicalPlan; import org.elasticsearch.xpack.sql.plan.logical.OrderBy; +import org.elasticsearch.xpack.sql.plan.logical.Project; import org.elasticsearch.xpack.sql.tree.Node; import org.elasticsearch.xpack.sql.type.DataType; import org.elasticsearch.xpack.sql.util.StringUtils; @@ -40,7 +43,9 @@ import static java.lang.String.format; -abstract class Verifier { +final class Verifier { + + private Verifier() {} static class Failure { private final Node source; @@ -188,6 +193,16 @@ static Collection verify(LogicalPlan plan) { Set localFailures = new LinkedHashSet<>(); + if (p instanceof Filter) { + Filter filterPlan = (Filter) p; + validateInExpression(filterPlan.condition(), localFailures); + } else if (p instanceof Project) { + Project projectPlan = (Project) p; + for (NamedExpression ne : projectPlan.projections()) { + validateInExpression(ne, localFailures); + } + } + if (!groupingFailures.contains(p)) { checkGroupBy(p, localFailures, resolvedFunctions, groupingFailures); } @@ -488,4 +503,25 @@ private static void checkNestedUsedInGroupByOrHaving(LogicalPlan p, Set fail(nested.get(0), "HAVING isn't (yet) compatible with nested fields " + new AttributeSet(nested).names())); } } -} \ No newline at end of file + + private static void validateInExpression(Expression e, Set localFailures) { + if (e instanceof In) { + In in = (In) e; + DataType dt = null; + for (Expression rightValue : in.list()) { + if (dt == null) { + dt = rightValue.dataType(); + } else { + if (rightValue.dataType() != dt) { + localFailures.add(fail(rightValue, "expected data type [%s], value provided is of type [%s]", + dt, rightValue.dataType())); + } + } + } + } else { + for (Expression child : e.children()) { + validateInExpression(child, localFailures); + } + } + } +} diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java index fb04f6d438a91..6d00c6920301b 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java @@ -8,29 +8,43 @@ import org.elasticsearch.xpack.sql.SqlIllegalArgumentException; import org.elasticsearch.xpack.sql.expression.Attribute; import org.elasticsearch.xpack.sql.expression.Expression; +import org.elasticsearch.xpack.sql.expression.Expressions; import org.elasticsearch.xpack.sql.expression.NamedExpression; +import org.elasticsearch.xpack.sql.expression.function.scalar.ScalarFunctionAttribute; +import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe; +import org.elasticsearch.xpack.sql.expression.gen.script.Params; +import org.elasticsearch.xpack.sql.expression.gen.script.ParamsBuilder; import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate; +import org.elasticsearch.xpack.sql.expression.gen.script.ScriptWeaver; +import org.elasticsearch.xpack.sql.expression.predicate.operator.comparison.Comparisons; +import org.elasticsearch.xpack.sql.expression.predicate.operator.comparison.InPipe; import org.elasticsearch.xpack.sql.tree.Location; import org.elasticsearch.xpack.sql.tree.NodeInfo; import org.elasticsearch.xpack.sql.type.DataType; import org.elasticsearch.xpack.sql.util.CollectionUtils; +import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.Objects; +import java.util.StringJoiner; +import java.util.stream.Collectors; -public class In extends NamedExpression { +import static java.lang.String.format; +import static org.elasticsearch.xpack.sql.expression.gen.script.ParamsBuilder.paramsBuilder; + +public class In extends NamedExpression implements ScriptWeaver { private final Expression value; private final List list; - private final boolean nullable, foldable; + private Boolean lazyNullable, lazyFoldable; + private List foldedList; + private Attribute lazyAttribute; public In(Location location, Expression value, List list) { super(location, null, CollectionUtils.combine(list, value), null); this.value = value; this.list = list; - - this.nullable = children().stream().anyMatch(Expression::nullable); - this.foldable = children().stream().allMatch(Expression::foldable); } @Override @@ -40,7 +54,7 @@ protected NodeInfo info() { @Override public Expression replaceChildren(List newChildren) { - if (newChildren.size() < 1) { + if (newChildren.isEmpty()) { throw new IllegalArgumentException("expected one or more children but received [" + newChildren.size() + "]"); } return new In(location(), newChildren.get(newChildren.size() - 1), newChildren.subList(0, newChildren.size() - 1)); @@ -54,6 +68,10 @@ public List list() { return list; } + public List foldedList() { + return foldedList; + } + @Override public DataType dataType() { return DataType.BOOLEAN; @@ -61,22 +79,85 @@ public DataType dataType() { @Override public boolean nullable() { - return nullable; + if (lazyNullable == null) { + lazyNullable = children().stream().anyMatch(Expression::nullable); + } + return lazyNullable; } @Override public boolean foldable() { - return foldable; + if (lazyFoldable == null) { + lazyFoldable = children().stream().allMatch(Expression::foldable) && value.foldable(); + foldedList = new ArrayList<>(list.size()); + list.forEach(e -> foldedList.add(e.foldable() ? e.fold() : e)); + } + return lazyFoldable; + } + + @Override + public Object fold() { + if (!foldable()) { + throw new SqlIllegalArgumentException("Cannot fold if not everything in `IN` expression is foldable"); + } + Object foldedLeftValue = value.fold(); + + for (Object rightValue : foldedList) { + Boolean compResult = Comparisons.eq(foldedLeftValue, rightValue); + if (compResult != null && compResult) { + return true; + } + } + return false; + } + + @Override + public String name() { + StringJoiner sj = new StringJoiner(", ", " IN(", ")"); + list.forEach(e -> sj.add(Expressions.name(e))); + return Expressions.name(value) + sj.toString(); } @Override public Attribute toAttribute() { - throw new SqlIllegalArgumentException("not implemented yet"); + if (lazyAttribute == null) { + lazyAttribute = new ScalarFunctionAttribute(location(), name(), dataType(), null, + false, id(), false, "IN", asScript(), null, asPipe()); + } + return lazyAttribute; } @Override public ScriptTemplate asScript() { - throw new SqlIllegalArgumentException("not implemented yet"); + StringJoiner sj = new StringJoiner(" || "); + ScriptTemplate leftScript = asScript(value); + List rightParams = new ArrayList<>(); + String scriptPrefix = leftScript + "=="; + for (Object e : foldedList) { + if (e instanceof Expression) { + ScriptTemplate rightScript = asScript((Expression) e); + sj.add(scriptPrefix + rightScript.template()); + rightParams.add(rightScript.params()); + } else { + if (e instanceof String) { + sj.add(scriptPrefix + "'" + e + "'"); + } else { + sj.add(scriptPrefix + e.toString()); + } + } + } + + ParamsBuilder paramsBuilder = paramsBuilder().script(leftScript.params()); + for (Params p : rightParams) { + paramsBuilder = paramsBuilder.script(p); + } + + return new ScriptTemplate(format(Locale.ROOT, "%s", sj.toString()), paramsBuilder.build(), dataType()); + } + + @Override + protected Pipe makePipe() { + return new InPipe(location(), this, Expressions.pipe(value()), list.stream().map(Expressions::pipe).collect(Collectors.toList())); } @Override @@ -97,4 +178,4 @@ public boolean equals(Object obj) { return Objects.equals(value, other.value) && Objects.equals(list, other.list); } -} \ No newline at end of file +} diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/Comparisons.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/Comparisons.java index cdd293cb1afb1..0ab36f45fa7d0 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/Comparisons.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/Comparisons.java @@ -5,34 +5,42 @@ */ package org.elasticsearch.xpack.sql.expression.predicate.operator.comparison; +import java.util.Set; + /** * Comparison utilities. */ -abstract class Comparisons { +public final class Comparisons { + + private Comparisons() {} - static Boolean eq(Object l, Object r) { + public static Boolean eq(Object l, Object r) { Integer i = compare(l, r); - return i == null ? null : i.intValue() == 0; + return i == null ? null : i == 0; } static Boolean lt(Object l, Object r) { Integer i = compare(l, r); - return i == null ? null : i.intValue() < 0; + return i == null ? null : i < 0; } static Boolean lte(Object l, Object r) { Integer i = compare(l, r); - return i == null ? null : i.intValue() <= 0; + return i == null ? null : i <= 0; } static Boolean gt(Object l, Object r) { Integer i = compare(l, r); - return i == null ? null : i.intValue() > 0; + return i == null ? null : i > 0; } static Boolean gte(Object l, Object r) { Integer i = compare(l, r); - return i == null ? null : i.intValue() >= 0; + return i == null ? null : i >= 0; + } + + static Boolean in(Object l, Set r) { + return r.contains(l); } /** @@ -49,7 +57,7 @@ static Integer compare(Object l, Object r) { if (l instanceof Comparable && r instanceof Comparable) { try { - return Integer.valueOf(((Comparable) l).compareTo(r)); + return ((Comparable) l).compareTo(r); } catch (ClassCastException cce) { // when types are not compatible, cce is thrown // fall back to null @@ -71,6 +79,6 @@ private static Integer compare(Number l, Number r) { return Long.compare(l.longValue(), r.longValue()); } - return Integer.valueOf(Integer.compare(l.intValue(), r.intValue())); + return Integer.compare(l.intValue(), r.intValue()); } -} \ No newline at end of file +} diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InPipe.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InPipe.java new file mode 100644 index 0000000000000..eaf911b78bb93 --- /dev/null +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InPipe.java @@ -0,0 +1,104 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.xpack.sql.expression.predicate.operator.comparison; + +import org.elasticsearch.xpack.sql.execution.search.FieldExtraction; +import org.elasticsearch.xpack.sql.execution.search.SqlSourceBuilder; +import org.elasticsearch.xpack.sql.expression.Expression; +import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe; +import org.elasticsearch.xpack.sql.tree.Location; +import org.elasticsearch.xpack.sql.tree.NodeInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class InPipe extends Pipe { + + private Pipe left; + private List right; + + public InPipe(Location location, Expression expression, Pipe left, List right) { + super(location, expression, Stream.concat(Stream.of(left), right.stream()).collect(Collectors.toList())); + this.left = left; + this.right = right; + } + + @Override + public final Pipe replaceChildren(List newChildren) { + if (newChildren.size() < 2) { + throw new IllegalArgumentException("expected at least [2] children but received [" + newChildren.size() + "]"); + } + left = newChildren.get(0); + return new InPipe(location(), expression(), newChildren.get(0), newChildren.subList(1, newChildren.size())); + } + + @Override + protected NodeInfo info() { + return NodeInfo.create(this, InPipe::new, expression(), left, right); + } + + public Pipe left() { + return left; + } + + public List right() { + return right; + } + + @Override + public boolean supportedByAggsOnlyQuery() { + return left.supportedByAggsOnlyQuery() && right.stream().allMatch(FieldExtraction::supportedByAggsOnlyQuery); + } + + @Override + public final Pipe resolveAttributes(AttributeResolver resolver) { + Pipe newLeft = left.resolveAttributes(resolver); + List newRight = new ArrayList<>(right.size()); + for (Pipe p : right) { + newRight.add(p.resolveAttributes(resolver)); + } + return replaceChildren(Stream.concat(Stream.of(newLeft), newRight.stream()).collect(Collectors.toList())); + } + + @Override + public boolean resolved() { + return left().resolved() && right().stream().allMatch(Pipe::resolved); + } + + @Override + public final void collectFields(SqlSourceBuilder sourceBuilder) { + left.collectFields(sourceBuilder); + right.forEach(p -> p.collectFields(sourceBuilder)); + } + + @Override + public int hashCode() { + return Objects.hash(left(), right()); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + InPipe other = (InPipe) obj; + return Objects.equals(left(), other.left()) + && Objects.equals(right(), other.right()); + } + + @Override + public InProcessor asProcessor() { + return new InProcessor(left().asProcessor(), right().stream().map(Pipe::asProcessor).collect(Collectors.toList())); + } +} diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java new file mode 100644 index 0000000000000..30efdef09648d --- /dev/null +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.xpack.sql.expression.predicate.operator.comparison; + +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.xpack.sql.expression.gen.processor.Processor; + +import java.io.IOException; +import java.util.List; + +class InProcessor implements Processor { + + public static final String NAME = "in"; + + private final Processor left; + private final List rightList; + + InProcessor(Processor left, List rightList) { + this.left = left; + this.rightList = rightList; + } + + InProcessor(StreamInput in) throws IOException { + left = in.readNamedWriteable(Processor.class); + rightList = in.readNamedWriteableList(Processor.class); + } + + @Override + public String getWriteableName() { + return NAME; + } + + @Override + public final void writeTo(StreamOutput out) throws IOException { + out.writeNamedWriteable(left); + out.writeNamedWriteableList(rightList); + } + + @Override + public Object process(Object input) { + Object leftValue = left.process(input); + for (Processor p : rightList) { + Boolean compResult = Comparisons.eq(leftValue, p.process(input)); + if (compResult != null && compResult) { + return true; + } + } + return false; + } +} diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryFolder.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryFolder.java index 8c81301933085..554f2a0a8b253 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryFolder.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryFolder.java @@ -29,6 +29,7 @@ import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe; import org.elasticsearch.xpack.sql.expression.gen.pipeline.UnaryPipe; import org.elasticsearch.xpack.sql.expression.gen.processor.Processor; +import org.elasticsearch.xpack.sql.expression.predicate.In; import org.elasticsearch.xpack.sql.plan.physical.AggregateExec; import org.elasticsearch.xpack.sql.plan.physical.EsQueryExec; import org.elasticsearch.xpack.sql.plan.physical.FilterExec; @@ -137,6 +138,9 @@ protected PhysicalPlan rule(ProjectExec project) { if (pj instanceof ScalarFunction) { ScalarFunction f = (ScalarFunction) pj; processors.put(f.toAttribute(), Expressions.pipe(f)); + } else if (pj instanceof In) { + In in = (In) pj; + processors.put(in.toAttribute(), Expressions.pipe(in)); } } } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java index 12b68ceee3336..3e79932c2b5bf 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java @@ -34,6 +34,7 @@ import org.elasticsearch.xpack.sql.expression.gen.script.ScriptTemplate; import org.elasticsearch.xpack.sql.expression.predicate.And; import org.elasticsearch.xpack.sql.expression.predicate.BinaryPredicate; +import org.elasticsearch.xpack.sql.expression.predicate.In; import org.elasticsearch.xpack.sql.expression.predicate.IsNotNull; import org.elasticsearch.xpack.sql.expression.predicate.Not; import org.elasticsearch.xpack.sql.expression.predicate.Or; @@ -80,26 +81,32 @@ import org.elasticsearch.xpack.sql.querydsl.query.RegexQuery; import org.elasticsearch.xpack.sql.querydsl.query.ScriptQuery; import org.elasticsearch.xpack.sql.querydsl.query.TermQuery; +import org.elasticsearch.xpack.sql.querydsl.query.TermsQuery; import org.elasticsearch.xpack.sql.querydsl.query.WildcardQuery; import org.elasticsearch.xpack.sql.tree.Location; import org.elasticsearch.xpack.sql.util.Check; import org.elasticsearch.xpack.sql.util.ReflectionUtils; +import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; import static java.util.Collections.singletonList; import static org.elasticsearch.xpack.sql.expression.Foldables.doubleValuesOf; import static org.elasticsearch.xpack.sql.expression.Foldables.stringValueOf; import static org.elasticsearch.xpack.sql.expression.Foldables.valueOf; -abstract class QueryTranslator { +final class QueryTranslator { - static final List> QUERY_TRANSLATORS = Arrays.asList( + private QueryTranslator(){} + + private static final List> QUERY_TRANSLATORS = Arrays.asList( new BinaryComparisons(), + new InComparisons(), new Ranges(), new BinaryLogic(), new Nots(), @@ -110,7 +117,7 @@ abstract class QueryTranslator { new MultiMatches() ); - static final List> AGG_TRANSLATORS = Arrays.asList( + private static final List> AGG_TRANSLATORS = Arrays.asList( new Maxes(), new Mins(), new Avgs(), @@ -144,7 +151,7 @@ static class QueryTranslation { } static QueryTranslation toQuery(Expression e, boolean onAggs) { - QueryTranslation translation = null; + QueryTranslation translation; for (ExpressionTranslator translator : QUERY_TRANSLATORS) { translation = translator.translate(e, onAggs); if (translation != null) { @@ -235,7 +242,7 @@ static GroupingContext groupBy(List groupings) { } aggId = ne.id().toString(); - GroupByKey key = null; + GroupByKey key; // handle functions differently if (exp instanceof Function) { @@ -281,7 +288,7 @@ static QueryTranslation and(Location loc, QueryTranslation left, QueryTranslatio newQ = and(loc, left.query, right.query); } - AggFilter aggFilter = null; + AggFilter aggFilter; if (left.aggFilter == null) { aggFilter = right.aggFilter; @@ -572,6 +579,55 @@ private static Query translateQuery(BinaryComparison bc) { } } + // assume the Optimizer properly orders the predicates to ease the translation + static class InComparisons extends ExpressionTranslator { + + @Override + protected QueryTranslation asQuery(In in, boolean onAggs) { + Optional firstNotFoldable = in.list().stream().filter(expression -> !expression.foldable()).findFirst(); + + if (firstNotFoldable.isPresent()) { + throw new SqlIllegalArgumentException( + "Line {}:{}: Comparisons against variables are not (currently) supported; offender [{}] in [{}]", + firstNotFoldable.get().location().getLineNumber(), + firstNotFoldable.get().location().getColumnNumber(), + Expressions.name(firstNotFoldable.get()), + in.name()); + } + + if (in.value() instanceof NamedExpression) { + NamedExpression ne = (NamedExpression) in.value(); + + Query query = null; + AggFilter aggFilter = null; + + Attribute at = ne.toAttribute(); + // + // Agg context means HAVING -> PipelineAggs + // + ScriptTemplate script = in.asScript(); + if (onAggs) { + aggFilter = new AggFilter(at.id().toString(), script); + } + else { + // query directly on the field + if (at instanceof FieldAttribute) { + query = wrapIfNested(new TermsQuery(in.location(), ne.name(), new ArrayList<>(in.foldedList())), ne); + } else { + query = new ScriptQuery(at.location(), script); + } + } + return new QueryTranslation(query, aggFilter); + } + // + // if the code gets here it's a bug + // + else { + throw new UnsupportedOperationException("No idea how to translate " + in.value()); + } + } + } + static class Ranges extends ExpressionTranslator { @Override @@ -759,4 +815,4 @@ protected static Query wrapIfNested(Query query, Expression exp) { return query; } } -} \ No newline at end of file +} diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java new file mode 100644 index 0000000000000..799b2fbbe5eed --- /dev/null +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.xpack.sql.querydsl.query; + +import org.elasticsearch.index.query.QueryBuilder; +import org.elasticsearch.xpack.sql.tree.Location; + +import java.util.List; +import java.util.Objects; + +import static org.elasticsearch.index.query.QueryBuilders.termsQuery; + +public class TermsQuery extends LeafQuery { + + private final String term; + private final List values; + + public TermsQuery(Location location, String term, List values) { + super(location); + this.term = term; + this.values = values; + } + + public String term() { + return term; + } + + public List values() { + return values; + } + + @Override + public QueryBuilder asBuilder() { + return termsQuery(term, values); + } + + @Override + public int hashCode() { + return Objects.hash(term, values); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + TermsQuery other = (TermsQuery) obj; + return Objects.equals(term, other.term) + && Objects.equals(values, other.values); + } + + @Override + protected String innerToString() { + return term + ":" + values; + } +} diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java index 95949070f2e51..ab40be5e260db 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java @@ -169,4 +169,24 @@ public void testHavingOnScalar() { assertEquals("1:42: Cannot filter HAVING on non-aggregate [int]; consider using WHERE instead", verify("SELECT int FROM test GROUP BY int HAVING 2 < ABS(int)")); } -} \ No newline at end of file + + public void testInWithDifferentDataTypes_SelectClause() { + assertEquals("1:17: expected data type [INTEGER], value provided is of type [KEYWORD]", + verify("SELECT 1 IN (2, '3', 4)")); + } + + public void testInNestedWithDifferentDataTypes_SelectClause() { + assertEquals("1:27: expected data type [INTEGER], value provided is of type [KEYWORD]", + verify("SELECT 1 = 1 OR 1 IN (2, '3', 4)")); + } + + public void testInWithDifferentDataTypes_WhereClause() { + assertEquals("1:49: expected data type [KEYWORD], value provided is of type [INTEGER]", + verify("SELECT * FROM test WHERE text IN ('foo', 'bar', 4)")); + } + + public void testInNestedWithDifferentDataTypes_WhereClause() { + assertEquals("1:60: expected data type [KEYWORD], value provided is of type [INTEGER]", + verify("SELECT * FROM test WHERE int = 1 OR text IN ('foo', 'bar', 2)")); + } +} diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java index 71f4dab679c99..42c0a8f83db24 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java @@ -5,7 +5,7 @@ */ package org.elasticsearch.xpack.sql.planner; -import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.test.AbstractBuilderTestCase; import org.elasticsearch.xpack.sql.SqlIllegalArgumentException; import org.elasticsearch.xpack.sql.analysis.analyzer.Analyzer; import org.elasticsearch.xpack.sql.analysis.index.EsIndex; @@ -20,30 +20,33 @@ import org.elasticsearch.xpack.sql.planner.QueryTranslator.QueryTranslation; import org.elasticsearch.xpack.sql.querydsl.query.Query; import org.elasticsearch.xpack.sql.querydsl.query.RangeQuery; +import org.elasticsearch.xpack.sql.querydsl.query.ScriptQuery; import org.elasticsearch.xpack.sql.querydsl.query.TermQuery; +import org.elasticsearch.xpack.sql.querydsl.query.TermsQuery; import org.elasticsearch.xpack.sql.type.EsField; import org.elasticsearch.xpack.sql.type.TypesTests; import org.joda.time.DateTime; +import org.junit.BeforeClass; +import java.io.IOException; import java.util.Map; import java.util.TimeZone; -public class QueryTranslatorTests extends ESTestCase { +import static org.hamcrest.core.StringStartsWith.startsWith; - private SqlParser parser; - private IndexResolution getIndexResult; - private FunctionRegistry functionRegistry; - private Analyzer analyzer; - - public QueryTranslatorTests() { +public class QueryTranslatorTests extends AbstractBuilderTestCase { + + private static SqlParser parser; + private static Analyzer analyzer; + + @BeforeClass + public static void init() { parser = new SqlParser(); - functionRegistry = new FunctionRegistry(); Map mapping = TypesTests.loadMapping("mapping-multi-field-variation.json"); - EsIndex test = new EsIndex("test", mapping); - getIndexResult = IndexResolution.valid(test); - analyzer = new Analyzer(functionRegistry, getIndexResult, TimeZone.getTimeZone("UTC")); + IndexResolution getIndexResult = IndexResolution.valid(test); + analyzer = new Analyzer(new FunctionRegistry(), getIndexResult, TimeZone.getTimeZone("UTC")); } private LogicalPlan plan(String sql) { @@ -149,4 +152,41 @@ public void testLikeConstructsNotSupported() { SqlIllegalArgumentException ex = expectThrows(SqlIllegalArgumentException.class, () -> QueryTranslator.toQuery(condition, false)); assertEquals("Scalar function (LTRIM(keyword)) not allowed (yet) as arguments for LIKE", ex.getMessage()); } -} \ No newline at end of file + + public void testTranslateInExpression_WhereClause() throws IOException { + LogicalPlan p = plan("SELECT * FROM test WHERE keyword IN ('foo', 'bar', 'lala')"); + assertTrue(p instanceof Project); + assertTrue(p.children().get(0) instanceof Filter); + Expression condition = ((Filter) p.children().get(0)).condition(); + assertFalse(condition.foldable()); + QueryTranslation translation = QueryTranslator.toQuery(condition, false); + Query query = translation.query; + assertTrue(query instanceof TermsQuery); + TermsQuery tq = (TermsQuery) query; + assertEquals("keyword:(bar foo lala)", tq.asBuilder().toQuery(createShardContext()).toString()); + } + + public void testTranslateInExpressionInvalidValues_WhereClause() { + LogicalPlan p = plan("SELECT * FROM test WHERE keyword IN ('foo', 'bar', keyword)"); + assertTrue(p instanceof Project); + assertTrue(p.children().get(0) instanceof Filter); + Expression condition = ((Filter) p.children().get(0)).condition(); + assertFalse(condition.foldable()); + SqlIllegalArgumentException ex = expectThrows(SqlIllegalArgumentException.class, () -> QueryTranslator.toQuery(condition, false)); + assertEquals("Line 1:52: Comparisons against variables are not (currently) supported; " + + "offender [keyword] in [keyword IN(foo, bar, keyword)]", ex.getMessage()); + } + + public void testTranslateInExpression_HavingClause_Painless() { + LogicalPlan p = plan("SELECT keyword, max(int) FROM test GROUP BY keyword HAVING max(int) in (10, 20)"); + assertTrue(p instanceof Project); + assertTrue(p.children().get(0) instanceof Filter); + Expression condition = ((Filter) p.children().get(0)).condition(); + assertFalse(condition.foldable()); + QueryTranslation translation = QueryTranslator.toQuery(condition, false); + assertTrue(translation.query instanceof ScriptQuery); + ScriptQuery sq = (ScriptQuery) translation.query; + assertEquals("params.a0==10 || params.a0==20", sq.script().toString()); + assertThat(sq.script().params().toString(), startsWith("[{a=MAX(int){a->")); + } +} diff --git a/x-pack/qa/sql/src/main/resources/agg.sql-spec b/x-pack/qa/sql/src/main/resources/agg.sql-spec index a61c825623cb9..6e520de3e6623 100644 --- a/x-pack/qa/sql/src/main/resources/agg.sql-spec +++ b/x-pack/qa/sql/src/main/resources/agg.sql-spec @@ -412,4 +412,9 @@ SELECT MIN(emp_no) AS a, 1 + MIN(emp_no) AS b, ABS(MIN(emp_no)) AS c FROM test_e aggRepeatFunctionBetweenSelectAndHaving SELECT gender, COUNT(DISTINCT languages) AS c FROM test_emp GROUP BY gender HAVING count(DISTINCT languages) > 0 ORDER BY gender; +// filter with IN +aggMultiWithHavingUsingIn +SELECT MIN(salary) min, MAX(salary) max, gender g, COUNT(*) c FROM "test_emp" WHERE languages > 0 GROUP BY g HAVING max IN(74999, 74600) ORDER BY gender; +aggMultiGroupByMultiWithHavingUsingIn +SELECT MIN(salary) min, MAX(salary) max, gender g, languages l, COUNT(*) c FROM "test_emp" WHERE languages > 0 GROUP BY g, languages HAVING max IN (74500, 74600) ORDER BY gender, languages; \ No newline at end of file diff --git a/x-pack/qa/sql/src/main/resources/filter.sql-spec b/x-pack/qa/sql/src/main/resources/filter.sql-spec index 5112fbc15511d..414eb5847a73d 100644 --- a/x-pack/qa/sql/src/main/resources/filter.sql-spec +++ b/x-pack/qa/sql/src/main/resources/filter.sql-spec @@ -78,3 +78,19 @@ SELECT last_name l FROM "test_emp" WHERE emp_no BETWEEN 9990 AND 10003 ORDER BY // end::whereBetween whereNotBetween SELECT last_name l FROM "test_emp" WHERE emp_no NOT BETWEEN 10010 AND 10020 ORDER BY emp_no LIMIT 5; + +// +// IN expression +// +whereWithInAndOneValue +SELECT last_name l FROM "test_emp" WHERE emp_no IN (10001); +whereWithInAndMultipleValues +SELECT last_name l FROM "test_emp" WHERE emp_no IN (10000, 10001, 10002, 999) ORDER BY emp_no LIMIT 5; + +whereWithInAndOneValueWithNegation +SELECT last_name l FROM "test_emp" WHERE emp_no NOT IN (10001) ORDER BY emp_no LIMIT 5; +whereWithInAndMultipleValuesAndNegation +SELECT last_name l FROM "test_emp" WHERE emp_no NOT IN (10000, 10001, 10002, 999) ORDER BY emp_no LIMIT 5; + +whereWithInAndComplexFunctions +SELECT last_name l FROM "test_emp" WHERE emp_no NOT IN (10000, abs(2 - 10003), 10002, 999) AND lcase(first_name) IN ('sumant', 'mary', 'Patricio', 'NoMatch') ORDER BY emp_no LIMIT 5; diff --git a/x-pack/qa/sql/src/main/resources/select.csv-spec b/x-pack/qa/sql/src/main/resources/select.csv-spec new file mode 100644 index 0000000000000..5181f7f699b15 --- /dev/null +++ b/x-pack/qa/sql/src/main/resources/select.csv-spec @@ -0,0 +1,67 @@ +// SELECT with IN +inWithLiterals +SELECT 1 IN (1, 2, 3), 1 IN (2, 3); + + 1 IN (1, 2, 3) | 1 IN (2, 3) +-----------------+------------- +true |false +; + +inWithLiteralsAndFunctions +SELECT 1 IN (2 - 1, 2, 3), abs(-1) IN (2, 3, abs(4 - 5)); + + 1 IN (1, 2, 3) | 1 IN (2, 3) +-----------------+------------- +true |false +; + + +inWithLiteralsAndNegation +SELECT NOT 1 IN (1, 1 + 1, 3), NOT 1 IN (2, 3); + + 1 IN (1, 2, 3) | 1 IN (2, 3) +-----------------+------------- +false |true +; + + +// +// SELECT with IN +// +inWithTableColumn +SELECT emp_no IN (10000, 10001, 10002) FROM test_emp ORDER BY 1; + + emp_no +------- +10001 +10002 +; + +inWithTableColumnAndFunction +SELECT emp_no IN (10000, 10000 + 1, abs(-10000 - 2)) FROM test_emp; + + emp_no +------- +10001 +10002 +; + +inWithTableColumnAndNegation +SELECT emp_no NOT IN (10000, 10000 + 1, 10002) FROM test_emp ORDER BY 1 LIMIT 3; + + emp_no +------- +10003 +10004 +10005 +; + +inWithTableColumnAndComplexFunctions +SELECT 1 IN (1, abs(2 - 4), 3) OR emp_no NOT IN (10000, 10000 + 1, 10002) FROM test_emp ORDER BY 1 LIMIT 3; + + emp_no +------- +10003 +10004 +10005 +; \ No newline at end of file From 8c3beb3bc2edad7dfb57091b4657c3f33f53ef15 Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Thu, 18 Oct 2018 13:58:54 +0200 Subject: [PATCH 02/17] Fix painless script to handle `'` in string values. --- .../org/elasticsearch/xpack/sql/expression/predicate/In.java | 2 +- x-pack/qa/sql/src/main/resources/filter.sql-spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java index 6d00c6920301b..16442e9203111 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java @@ -140,7 +140,7 @@ public ScriptTemplate asScript() { rightParams.add(rightScript.params()); } else { if (e instanceof String) { - sj.add(scriptPrefix + "'" + e + "'"); + sj.add(scriptPrefix + '"' + e + '"'); } else { sj.add(scriptPrefix + e.toString()); } diff --git a/x-pack/qa/sql/src/main/resources/filter.sql-spec b/x-pack/qa/sql/src/main/resources/filter.sql-spec index 414eb5847a73d..b0538be0da634 100644 --- a/x-pack/qa/sql/src/main/resources/filter.sql-spec +++ b/x-pack/qa/sql/src/main/resources/filter.sql-spec @@ -93,4 +93,4 @@ whereWithInAndMultipleValuesAndNegation SELECT last_name l FROM "test_emp" WHERE emp_no NOT IN (10000, 10001, 10002, 999) ORDER BY emp_no LIMIT 5; whereWithInAndComplexFunctions -SELECT last_name l FROM "test_emp" WHERE emp_no NOT IN (10000, abs(2 - 10003), 10002, 999) AND lcase(first_name) IN ('sumant', 'mary', 'Patricio', 'NoMatch') ORDER BY emp_no LIMIT 5; +SELECT last_name l FROM "test_emp" WHERE emp_no NOT IN (10000, abs(2 - 10003), 10002, 999) AND lcase(first_name) IN ('sumant', 'mary', 'patricio', 'No''Match') ORDER BY emp_no LIMIT 5; From 527f83bbcead526ae75deb5b8611aec595f2aee2 Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Thu, 18 Oct 2018 18:20:50 +0200 Subject: [PATCH 03/17] Fix failing test, reset static variables --- .../xpack/sql/planner/QueryTranslatorTests.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java index 42c0a8f83db24..adc547536659e 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java @@ -26,6 +26,7 @@ import org.elasticsearch.xpack.sql.type.EsField; import org.elasticsearch.xpack.sql.type.TypesTests; import org.joda.time.DateTime; +import org.junit.AfterClass; import org.junit.BeforeClass; import java.io.IOException; @@ -49,6 +50,12 @@ public static void init() { analyzer = new Analyzer(new FunctionRegistry(), getIndexResult, TimeZone.getTimeZone("UTC")); } + @AfterClass + public static void destroy() { + parser = null; + analyzer = null; + } + private LogicalPlan plan(String sql) { return analyzer.analyze(parser.createStatement(sql), true); } From ba330de1c9e8034407a2f2433c58719037574c21 Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Thu, 18 Oct 2018 18:21:11 +0200 Subject: [PATCH 04/17] Added check for compatible data types --- .../xpack/sql/type/DataType.java | 14 ++++++++++++- .../xpack/sql/analysis/analyzer/Verifier.java | 8 +++++++- .../analyzer/VerifierErrorMessagesTests.java | 20 +++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java index 05fb192f8d1da..0cb2ca840440f 100644 --- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java +++ b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java @@ -170,4 +170,16 @@ public static Class fromJdbcTypeToJava(SQLType jdbcType) { public static DataType fromEsType(String esType) { return DataType.valueOf(esType.toUpperCase(Locale.ROOT)); } -} \ No newline at end of file + + public boolean isCompatibleWith(DataType other) { + if (this == other) { + return true; + } else if (this.isString() && other.isString()) { + return true; + } else if (this.isNumeric() && other.isNumeric()) { + return true; + } else { + return false; + } + } +} diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java index 5db07463611f9..71e114c7a3735 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java @@ -511,10 +511,16 @@ private static void validateInExpression(Expression e, Set localFailure for (Expression rightValue : in.list()) { if (dt == null) { dt = rightValue.dataType(); + if (!in.value().dataType().isCompatibleWith(dt)) { + localFailures.add(fail(in.list().get(0), "expected data type [%s], value provided is of type [%s]", + in.value().dataType(), dt)); + return; + } } else { - if (rightValue.dataType() != dt) { + if (!rightValue.dataType().isCompatibleWith(dt)) { localFailures.add(fail(rightValue, "expected data type [%s], value provided is of type [%s]", dt, rightValue.dataType())); + return; } } } diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java index ab40be5e260db..8fa05c61a6243 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java @@ -180,6 +180,16 @@ public void testInNestedWithDifferentDataTypes_SelectClause() { verify("SELECT 1 = 1 OR 1 IN (2, '3', 4)")); } + public void testInWithDifferentDataTypesFromLeftValue_SelectClause() { + assertEquals("1:14: expected data type [INTEGER], value provided is of type [KEYWORD]", + verify("SELECT 1 IN ('foo', 'bar')")); + } + + public void testInNestedWithDifferentDataTypesFromLeftValue_SelectClause() { + assertEquals("1:29: expected data type [KEYWORD], value provided is of type [INTEGER]", + verify("SELECT 1 = 1 OR 'foo' IN (2, 3)")); + } + public void testInWithDifferentDataTypes_WhereClause() { assertEquals("1:49: expected data type [KEYWORD], value provided is of type [INTEGER]", verify("SELECT * FROM test WHERE text IN ('foo', 'bar', 4)")); @@ -189,4 +199,14 @@ public void testInNestedWithDifferentDataTypes_WhereClause() { assertEquals("1:60: expected data type [KEYWORD], value provided is of type [INTEGER]", verify("SELECT * FROM test WHERE int = 1 OR text IN ('foo', 'bar', 2)")); } + + public void testInWithDifferentDataTypesFromLeftValue_WhereClause() { + assertEquals("1:35: expected data type [TEXT], value provided is of type [INTEGER]", + verify("SELECT * FROM test WHERE text IN (1, 2)")); + } + + public void testInNestedWithDifferentDataTypesFromLeftValue_WhereClause() { + assertEquals("1:46: expected data type [TEXT], value provided is of type [INTEGER]", + verify("SELECT * FROM test WHERE int = 1 OR text IN (1, 2)")); + } } From 548bbd8c928a573c9cd71025d391f459b4255476 Mon Sep 17 00:00:00 2001 From: David Roberts Date: Thu, 18 Oct 2018 12:43:41 +0100 Subject: [PATCH 05/17] [TEST] Reduce forecast disk space requirement for tests (#34552) The setting that reduces the disk space requirement for the forecasting integration tests was accidentally removed in #31757 when files were moved around. This change simply adds back the setting that existed before that. --- x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle index 0c4304b123ea9..59867283f0c84 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle @@ -47,6 +47,7 @@ integTestCluster { setting 'xpack.security.transport.ssl.verification_mode', 'certificate' setting 'xpack.security.audit.enabled', 'true' setting 'xpack.license.self_generated.type', 'trial' + setting 'xpack.ml.min_disk_space_off_heap', '200mb' keystoreSetting 'bootstrap.password', 'x-pack-test-password' keystoreSetting 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode' From 27b18c47013b37c5f15a1e4d9b9c22a2c31cb96f Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Thu, 18 Oct 2018 09:09:09 -0400 Subject: [PATCH 06/17] Amazon: Wrap at 140 columns (#34495) Applies our standard column wrapping to the `discovery-ec2` and `repository-s3` plugins. --- .../resources/checkstyle_suppressions.xml | 7 - .../discovery/ec2/AbstractAwsTestCase.java | 3 +- .../discovery/ec2/AmazonEC2Mock.java | 653 ++++++++++++------ .../repositories/s3/S3Repository.java | 3 +- .../repositories/s3/AmazonS3Wrapper.java | 144 ++-- 5 files changed, 548 insertions(+), 262 deletions(-) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 056f23124b96d..b0ab7f9b7e9ac 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -658,11 +658,4 @@ - - - - - - - diff --git a/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/AbstractAwsTestCase.java b/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/AbstractAwsTestCase.java index dbe1f15d2ff88..72e4d5ec35d21 100644 --- a/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/AbstractAwsTestCase.java +++ b/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/AbstractAwsTestCase.java @@ -56,7 +56,8 @@ protected Settings nodeSettings(int nodeOrdinal) { throw new IllegalArgumentException("could not load aws tests config", e); } } else { - throw new IllegalStateException("to run integration tests, you need to set -Dtests.thirdparty=true and -Dtests.config=/path/to/elasticsearch.yml"); + throw new IllegalStateException( + "to run integration tests, you need to set -Dtests.thirdparty=true and -Dtests.config=/path/to/elasticsearch.yml"); } } catch (SettingsException exception) { throw new IllegalStateException("your test configuration file is incorrect: " + System.getProperty("tests.config"), exception); diff --git a/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/AmazonEC2Mock.java b/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/AmazonEC2Mock.java index 8a8477b2294a5..f1c373ee33a5a 100644 --- a/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/AmazonEC2Mock.java +++ b/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/AmazonEC2Mock.java @@ -562,7 +562,8 @@ public AmazonEC2Mock(int nodes, List> tagsList, AWSCredentialsProvider } @Override - public DescribeInstancesResult describeInstances(DescribeInstancesRequest describeInstancesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeInstancesResult describeInstances(DescribeInstancesRequest describeInstancesRequest) + throws AmazonServiceException, AmazonClientException { Collection filteredInstances = new ArrayList<>(); logger.debug("--> mocking describeInstances"); @@ -658,32 +659,39 @@ public void setRegion(Region region) throws IllegalArgumentException { @Override public AcceptReservedInstancesExchangeQuoteResult acceptReservedInstancesExchangeQuote( - AcceptReservedInstancesExchangeQuoteRequest acceptReservedInstancesExchangeQuoteRequest) throws AmazonServiceException, AmazonClientException { + AcceptReservedInstancesExchangeQuoteRequest acceptReservedInstancesExchangeQuoteRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public RebootInstancesResult rebootInstances(RebootInstancesRequest rebootInstancesRequest) throws AmazonServiceException, AmazonClientException { + public RebootInstancesResult rebootInstances(RebootInstancesRequest rebootInstancesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeReservedInstancesResult describeReservedInstances(DescribeReservedInstancesRequest describeReservedInstancesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeReservedInstancesResult describeReservedInstances( + DescribeReservedInstancesRequest describeReservedInstancesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateFlowLogsResult createFlowLogs(CreateFlowLogsRequest createFlowLogsRequest) throws AmazonServiceException, AmazonClientException { + public CreateFlowLogsResult createFlowLogs(CreateFlowLogsRequest createFlowLogsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeAvailabilityZonesResult describeAvailabilityZones(DescribeAvailabilityZonesRequest describeAvailabilityZonesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeAvailabilityZonesResult describeAvailabilityZones(DescribeAvailabilityZonesRequest describeAvailabilityZonesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public RestoreAddressToClassicResult restoreAddressToClassic(RestoreAddressToClassicRequest restoreAddressToClassicRequest) throws AmazonServiceException, AmazonClientException { + public RestoreAddressToClassicResult restoreAddressToClassic(RestoreAddressToClassicRequest restoreAddressToClassicRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -693,7 +701,8 @@ public DetachVolumeResult detachVolume(DetachVolumeRequest detachVolumeRequest) } @Override - public DeleteKeyPairResult deleteKeyPair(DeleteKeyPairRequest deleteKeyPairRequest) throws AmazonServiceException, AmazonClientException { + public DeleteKeyPairResult deleteKeyPair(DeleteKeyPairRequest deleteKeyPairRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -703,22 +712,28 @@ public DeleteNatGatewayResult deleteNatGateway(DeleteNatGatewayRequest deleteNat } @Override - public UnmonitorInstancesResult unmonitorInstances(UnmonitorInstancesRequest unmonitorInstancesRequest) throws AmazonServiceException, AmazonClientException { + public UnmonitorInstancesResult unmonitorInstances(UnmonitorInstancesRequest unmonitorInstancesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public UpdateSecurityGroupRuleDescriptionsIngressResult updateSecurityGroupRuleDescriptionsIngress(UpdateSecurityGroupRuleDescriptionsIngressRequest updateSecurityGroupRuleDescriptionsIngressRequest) throws AmazonServiceException, AmazonClientException { + public UpdateSecurityGroupRuleDescriptionsIngressResult updateSecurityGroupRuleDescriptionsIngress( + UpdateSecurityGroupRuleDescriptionsIngressRequest updateSecurityGroupRuleDescriptionsIngressRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public UpdateSecurityGroupRuleDescriptionsEgressResult updateSecurityGroupRuleDescriptionsEgress(UpdateSecurityGroupRuleDescriptionsEgressRequest updateSecurityGroupRuleDescriptionsEgressRequest) throws AmazonServiceException, AmazonClientException { + public UpdateSecurityGroupRuleDescriptionsEgressResult updateSecurityGroupRuleDescriptionsEgress( + UpdateSecurityGroupRuleDescriptionsEgressRequest updateSecurityGroupRuleDescriptionsEgressRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AttachVpnGatewayResult attachVpnGateway(AttachVpnGatewayRequest attachVpnGatewayRequest) throws AmazonServiceException, AmazonClientException { + public AttachVpnGatewayResult attachVpnGateway(AttachVpnGatewayRequest attachVpnGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -728,102 +743,125 @@ public CreateImageResult createImage(CreateImageRequest createImageRequest) thro } @Override - public DeleteSecurityGroupResult deleteSecurityGroup(DeleteSecurityGroupRequest deleteSecurityGroupRequest) throws AmazonServiceException, AmazonClientException { + public DeleteSecurityGroupResult deleteSecurityGroup(DeleteSecurityGroupRequest deleteSecurityGroupRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateInstanceExportTaskResult createInstanceExportTask(CreateInstanceExportTaskRequest createInstanceExportTaskRequest) throws AmazonServiceException, AmazonClientException { + public CreateInstanceExportTaskResult createInstanceExportTask(CreateInstanceExportTaskRequest createInstanceExportTaskRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AuthorizeSecurityGroupEgressResult authorizeSecurityGroupEgress(AuthorizeSecurityGroupEgressRequest authorizeSecurityGroupEgressRequest) throws AmazonServiceException, AmazonClientException { + public AuthorizeSecurityGroupEgressResult authorizeSecurityGroupEgress( + AuthorizeSecurityGroupEgressRequest authorizeSecurityGroupEgressRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AssociateDhcpOptionsResult associateDhcpOptions(AssociateDhcpOptionsRequest associateDhcpOptionsRequest) throws AmazonServiceException, AmazonClientException { + public AssociateDhcpOptionsResult associateDhcpOptions(AssociateDhcpOptionsRequest associateDhcpOptionsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public GetPasswordDataResult getPasswordData(GetPasswordDataRequest getPasswordDataRequest) throws AmazonServiceException, AmazonClientException { + public GetPasswordDataResult getPasswordData(GetPasswordDataRequest getPasswordDataRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public GetReservedInstancesExchangeQuoteResult getReservedInstancesExchangeQuote(GetReservedInstancesExchangeQuoteRequest getReservedInstancesExchangeQuoteRequest) throws AmazonServiceException, AmazonClientException { + public GetReservedInstancesExchangeQuoteResult getReservedInstancesExchangeQuote( + GetReservedInstancesExchangeQuoteRequest getReservedInstancesExchangeQuoteRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public StopInstancesResult stopInstances(StopInstancesRequest stopInstancesRequest) throws AmazonServiceException, AmazonClientException { + public StopInstancesResult stopInstances(StopInstancesRequest stopInstancesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ImportKeyPairResult importKeyPair(ImportKeyPairRequest importKeyPairRequest) throws AmazonServiceException, AmazonClientException { + public ImportKeyPairResult importKeyPair(ImportKeyPairRequest importKeyPairRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteNetworkInterfaceResult deleteNetworkInterface(DeleteNetworkInterfaceRequest deleteNetworkInterfaceRequest) throws AmazonServiceException, AmazonClientException { + public DeleteNetworkInterfaceResult deleteNetworkInterface(DeleteNetworkInterfaceRequest deleteNetworkInterfaceRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ModifyVpcAttributeResult modifyVpcAttribute(ModifyVpcAttributeRequest modifyVpcAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ModifyVpcAttributeResult modifyVpcAttribute(ModifyVpcAttributeRequest modifyVpcAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeSpotFleetInstancesResult describeSpotFleetInstances(DescribeSpotFleetInstancesRequest describeSpotFleetInstancesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSpotFleetInstancesResult describeSpotFleetInstances(DescribeSpotFleetInstancesRequest describeSpotFleetInstancesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateSecurityGroupResult createSecurityGroup(CreateSecurityGroupRequest createSecurityGroupRequest) throws AmazonServiceException, AmazonClientException { + public CreateSecurityGroupResult createSecurityGroup(CreateSecurityGroupRequest createSecurityGroupRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeSpotPriceHistoryResult describeSpotPriceHistory(DescribeSpotPriceHistoryRequest describeSpotPriceHistoryRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSpotPriceHistoryResult describeSpotPriceHistory(DescribeSpotPriceHistoryRequest describeSpotPriceHistoryRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeNetworkInterfacesResult describeNetworkInterfaces(DescribeNetworkInterfacesRequest describeNetworkInterfacesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeNetworkInterfacesResult describeNetworkInterfaces(DescribeNetworkInterfacesRequest describeNetworkInterfacesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeNetworkInterfacePermissionsResult describeNetworkInterfacePermissions(DescribeNetworkInterfacePermissionsRequest describeNetworkInterfacePermissionsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeNetworkInterfacePermissionsResult describeNetworkInterfacePermissions( + DescribeNetworkInterfacePermissionsRequest describeNetworkInterfacePermissionsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeRegionsResult describeRegions(DescribeRegionsRequest describeRegionsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeRegionsResult describeRegions(DescribeRegionsRequest describeRegionsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateDhcpOptionsResult createDhcpOptions(CreateDhcpOptionsRequest createDhcpOptionsRequest) throws AmazonServiceException, AmazonClientException { + public CreateDhcpOptionsResult createDhcpOptions(CreateDhcpOptionsRequest createDhcpOptionsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateReservedInstancesListingResult createReservedInstancesListing(CreateReservedInstancesListingRequest createReservedInstancesListingRequest) throws AmazonServiceException, AmazonClientException { + public CreateReservedInstancesListingResult createReservedInstancesListing( + CreateReservedInstancesListingRequest createReservedInstancesListingRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteVpcEndpointsResult deleteVpcEndpoints(DeleteVpcEndpointsRequest deleteVpcEndpointsRequest) throws AmazonServiceException, AmazonClientException { + public DeleteVpcEndpointsResult deleteVpcEndpoints(DeleteVpcEndpointsRequest deleteVpcEndpointsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ResetSnapshotAttributeResult resetSnapshotAttribute(ResetSnapshotAttributeRequest resetSnapshotAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ResetSnapshotAttributeResult resetSnapshotAttribute(ResetSnapshotAttributeRequest resetSnapshotAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -833,7 +871,8 @@ public DeleteRouteResult deleteRoute(DeleteRouteRequest deleteRouteRequest) thro } @Override - public DescribeInternetGatewaysResult describeInternetGateways(DescribeInternetGatewaysRequest describeInternetGatewaysRequest) throws AmazonServiceException, AmazonClientException { + public DescribeInternetGatewaysResult describeInternetGateways(DescribeInternetGatewaysRequest describeInternetGatewaysRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -853,47 +892,61 @@ public ModifyIdFormatResult modifyIdFormat(ModifyIdFormatRequest modifyIdFormatR } @Override - public DescribeSecurityGroupsResult describeSecurityGroups(DescribeSecurityGroupsRequest describeSecurityGroupsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSecurityGroupsResult describeSecurityGroups(DescribeSecurityGroupsRequest describeSecurityGroupsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeStaleSecurityGroupsResult describeStaleSecurityGroups(DescribeStaleSecurityGroupsRequest describeStaleSecurityGroupsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeStaleSecurityGroupsResult describeStaleSecurityGroups( + DescribeStaleSecurityGroupsRequest describeStaleSecurityGroupsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeSecurityGroupReferencesResult describeSecurityGroupReferences(DescribeSecurityGroupReferencesRequest describeSecurityGroupReferencesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSecurityGroupReferencesResult describeSecurityGroupReferences( + DescribeSecurityGroupReferencesRequest describeSecurityGroupReferencesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public RejectVpcPeeringConnectionResult rejectVpcPeeringConnection(RejectVpcPeeringConnectionRequest rejectVpcPeeringConnectionRequest) throws AmazonServiceException, AmazonClientException { + public RejectVpcPeeringConnectionResult rejectVpcPeeringConnection( + RejectVpcPeeringConnectionRequest rejectVpcPeeringConnectionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ModifyVpcPeeringConnectionOptionsResult modifyVpcPeeringConnectionOptions(ModifyVpcPeeringConnectionOptionsRequest modifyVpcPeeringConnectionOptionsRequest) throws AmazonServiceException, AmazonClientException { + public ModifyVpcPeeringConnectionOptionsResult modifyVpcPeeringConnectionOptions( + ModifyVpcPeeringConnectionOptionsRequest modifyVpcPeeringConnectionOptionsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteFlowLogsResult deleteFlowLogs(DeleteFlowLogsRequest deleteFlowLogsRequest) throws AmazonServiceException, AmazonClientException { + public DeleteFlowLogsResult deleteFlowLogs(DeleteFlowLogsRequest deleteFlowLogsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DetachVpnGatewayResult detachVpnGateway(DetachVpnGatewayRequest detachVpnGatewayRequest) throws AmazonServiceException, AmazonClientException { + public DetachVpnGatewayResult detachVpnGateway(DetachVpnGatewayRequest detachVpnGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeregisterImageResult deregisterImage(DeregisterImageRequest deregisterImageRequest) throws AmazonServiceException, AmazonClientException { + public DeregisterImageResult deregisterImage(DeregisterImageRequest deregisterImageRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeSpotDatafeedSubscriptionResult describeSpotDatafeedSubscription(DescribeSpotDatafeedSubscriptionRequest describeSpotDatafeedSubscriptionRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSpotDatafeedSubscriptionResult describeSpotDatafeedSubscription( + DescribeSpotDatafeedSubscriptionRequest describeSpotDatafeedSubscriptionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -903,37 +956,44 @@ public DeleteTagsResult deleteTags(DeleteTagsRequest deleteTagsRequest) throws A } @Override - public DeleteSubnetResult deleteSubnet(DeleteSubnetRequest deleteSubnetRequest) throws AmazonServiceException, AmazonClientException { + public DeleteSubnetResult deleteSubnet(DeleteSubnetRequest deleteSubnetRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeAccountAttributesResult describeAccountAttributes(DescribeAccountAttributesRequest describeAccountAttributesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeAccountAttributesResult describeAccountAttributes(DescribeAccountAttributesRequest describeAccountAttributesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AttachClassicLinkVpcResult attachClassicLinkVpc(AttachClassicLinkVpcRequest attachClassicLinkVpcRequest) throws AmazonServiceException, AmazonClientException { + public AttachClassicLinkVpcResult attachClassicLinkVpc(AttachClassicLinkVpcRequest attachClassicLinkVpcRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateVpnGatewayResult createVpnGateway(CreateVpnGatewayRequest createVpnGatewayRequest) throws AmazonServiceException, AmazonClientException { + public CreateVpnGatewayResult createVpnGateway(CreateVpnGatewayRequest createVpnGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public EnableVolumeIOResult enableVolumeIO(EnableVolumeIORequest enableVolumeIORequest) throws AmazonServiceException, AmazonClientException { + public EnableVolumeIOResult enableVolumeIO(EnableVolumeIORequest enableVolumeIORequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public MoveAddressToVpcResult moveAddressToVpc(MoveAddressToVpcRequest moveAddressToVpcRequest) throws AmazonServiceException, AmazonClientException { + public MoveAddressToVpcResult moveAddressToVpc(MoveAddressToVpcRequest moveAddressToVpcRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteVpnGatewayResult deleteVpnGateway(DeleteVpnGatewayRequest deleteVpnGatewayRequest) throws AmazonServiceException, AmazonClientException { + public DeleteVpnGatewayResult deleteVpnGateway(DeleteVpnGatewayRequest deleteVpnGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -943,37 +1003,46 @@ public AttachVolumeResult attachVolume(AttachVolumeRequest attachVolumeRequest) } @Override - public DescribeVolumeStatusResult describeVolumeStatus(DescribeVolumeStatusRequest describeVolumeStatusRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVolumeStatusResult describeVolumeStatus(DescribeVolumeStatusRequest describeVolumeStatusRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeVolumesModificationsResult describeVolumesModifications(DescribeVolumesModificationsRequest describeVolumesModificationsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVolumesModificationsResult describeVolumesModifications( + DescribeVolumesModificationsRequest describeVolumesModificationsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeImportSnapshotTasksResult describeImportSnapshotTasks(DescribeImportSnapshotTasksRequest describeImportSnapshotTasksRequest) throws AmazonServiceException, AmazonClientException { + public DescribeImportSnapshotTasksResult describeImportSnapshotTasks( + DescribeImportSnapshotTasksRequest describeImportSnapshotTasksRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeVpnConnectionsResult describeVpnConnections(DescribeVpnConnectionsRequest describeVpnConnectionsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVpnConnectionsResult describeVpnConnections(DescribeVpnConnectionsRequest describeVpnConnectionsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ResetImageAttributeResult resetImageAttribute(ResetImageAttributeRequest resetImageAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ResetImageAttributeResult resetImageAttribute(ResetImageAttributeRequest resetImageAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public EnableVgwRoutePropagationResult enableVgwRoutePropagation(EnableVgwRoutePropagationRequest enableVgwRoutePropagationRequest) throws AmazonServiceException, AmazonClientException { + public EnableVgwRoutePropagationResult enableVgwRoutePropagation(EnableVgwRoutePropagationRequest enableVgwRoutePropagationRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateSnapshotResult createSnapshot(CreateSnapshotRequest createSnapshotRequest) throws AmazonServiceException, AmazonClientException { + public CreateSnapshotResult createSnapshot(CreateSnapshotRequest createSnapshotRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -983,27 +1052,32 @@ public DeleteVolumeResult deleteVolume(DeleteVolumeRequest deleteVolumeRequest) } @Override - public CreateNetworkInterfaceResult createNetworkInterface(CreateNetworkInterfaceRequest createNetworkInterfaceRequest) throws AmazonServiceException, AmazonClientException { + public CreateNetworkInterfaceResult createNetworkInterface(CreateNetworkInterfaceRequest createNetworkInterfaceRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ModifyReservedInstancesResult modifyReservedInstances(ModifyReservedInstancesRequest modifyReservedInstancesRequest) throws AmazonServiceException, AmazonClientException { + public ModifyReservedInstancesResult modifyReservedInstances(ModifyReservedInstancesRequest modifyReservedInstancesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CancelSpotFleetRequestsResult cancelSpotFleetRequests(CancelSpotFleetRequestsRequest cancelSpotFleetRequestsRequest) throws AmazonServiceException, AmazonClientException { + public CancelSpotFleetRequestsResult cancelSpotFleetRequests(CancelSpotFleetRequestsRequest cancelSpotFleetRequestsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public UnassignPrivateIpAddressesResult unassignPrivateIpAddresses(UnassignPrivateIpAddressesRequest unassignPrivateIpAddressesRequest) throws AmazonServiceException, AmazonClientException { + public UnassignPrivateIpAddressesResult unassignPrivateIpAddresses(UnassignPrivateIpAddressesRequest unassignPrivateIpAddressesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public UnassignIpv6AddressesResult unassignIpv6Addresses(UnassignIpv6AddressesRequest unassignIpv6AddressesRequest) throws AmazonServiceException, AmazonClientException { + public UnassignIpv6AddressesResult unassignIpv6Addresses(UnassignIpv6AddressesRequest unassignIpv6AddressesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1013,253 +1087,309 @@ public DescribeVpcsResult describeVpcs(DescribeVpcsRequest describeVpcsRequest) } @Override - public CancelConversionTaskResult cancelConversionTask(CancelConversionTaskRequest cancelConversionTaskRequest) throws AmazonServiceException, AmazonClientException { + public CancelConversionTaskResult cancelConversionTask(CancelConversionTaskRequest cancelConversionTaskRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AssociateAddressResult associateAddress(AssociateAddressRequest associateAddressRequest) throws AmazonServiceException, AmazonClientException { + public AssociateAddressResult associateAddress(AssociateAddressRequest associateAddressRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AssociateIamInstanceProfileResult associateIamInstanceProfile(AssociateIamInstanceProfileRequest associateIamInstanceRequest) throws AmazonServiceException, AmazonClientException { + public AssociateIamInstanceProfileResult associateIamInstanceProfile(AssociateIamInstanceProfileRequest associateIamInstanceRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AssociateVpcCidrBlockResult associateVpcCidrBlock(AssociateVpcCidrBlockRequest associateVpcCidrBlockRequest) throws AmazonServiceException, AmazonClientException { + public AssociateVpcCidrBlockResult associateVpcCidrBlock(AssociateVpcCidrBlockRequest associateVpcCidrBlockRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AssociateSubnetCidrBlockResult associateSubnetCidrBlock(AssociateSubnetCidrBlockRequest associateSubnetCidrBlockRequest) throws AmazonServiceException, AmazonClientException { + public AssociateSubnetCidrBlockResult associateSubnetCidrBlock(AssociateSubnetCidrBlockRequest associateSubnetCidrBlockRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteCustomerGatewayResult deleteCustomerGateway(DeleteCustomerGatewayRequest deleteCustomerGatewayRequest) throws AmazonServiceException, AmazonClientException { + public DeleteCustomerGatewayResult deleteCustomerGateway(DeleteCustomerGatewayRequest deleteCustomerGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateNetworkAclEntryResult createNetworkAclEntry(CreateNetworkAclEntryRequest createNetworkAclEntryRequest) throws AmazonServiceException, AmazonClientException { + public CreateNetworkAclEntryResult createNetworkAclEntry(CreateNetworkAclEntryRequest createNetworkAclEntryRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AcceptVpcPeeringConnectionResult acceptVpcPeeringConnection(AcceptVpcPeeringConnectionRequest acceptVpcPeeringConnectionRequest) throws AmazonServiceException, AmazonClientException { + public AcceptVpcPeeringConnectionResult acceptVpcPeeringConnection(AcceptVpcPeeringConnectionRequest acceptVpcPeeringConnectionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeExportTasksResult describeExportTasks(DescribeExportTasksRequest describeExportTasksRequest) throws AmazonServiceException, AmazonClientException { + public DescribeExportTasksResult describeExportTasks(DescribeExportTasksRequest describeExportTasksRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeElasticGpusResult describeElasticGpus(DescribeElasticGpusRequest describeElasticGpusRequest) throws AmazonServiceException, AmazonClientException { + public DescribeElasticGpusResult describeElasticGpus(DescribeElasticGpusRequest describeElasticGpusRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeFpgaImagesResult describeFpgaImages(DescribeFpgaImagesRequest describeFpgaImagesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeFpgaImagesResult describeFpgaImages(DescribeFpgaImagesRequest describeFpgaImagesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeHostReservationOfferingsResult describeHostReservationOfferings(DescribeHostReservationOfferingsRequest describeHostReservationOfferingsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeHostReservationOfferingsResult describeHostReservationOfferings( + DescribeHostReservationOfferingsRequest describeHostReservationOfferingsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeHostReservationsResult describeHostReservations(DescribeHostReservationsRequest describeHostReservationsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeHostReservationsResult describeHostReservations(DescribeHostReservationsRequest describeHostReservationsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeIdentityIdFormatResult describeIdentityIdFormat(DescribeIdentityIdFormatRequest describeIdentityIdFormatRequest) throws AmazonServiceException, AmazonClientException { + public DescribeIdentityIdFormatResult describeIdentityIdFormat(DescribeIdentityIdFormatRequest describeIdentityIdFormatRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DetachInternetGatewayResult detachInternetGateway(DetachInternetGatewayRequest detachInternetGatewayRequest) throws AmazonServiceException, AmazonClientException { + public DetachInternetGatewayResult detachInternetGateway(DetachInternetGatewayRequest detachInternetGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateVpcPeeringConnectionResult createVpcPeeringConnection(CreateVpcPeeringConnectionRequest createVpcPeeringConnectionRequest) throws AmazonServiceException, AmazonClientException { + public CreateVpcPeeringConnectionResult createVpcPeeringConnection(CreateVpcPeeringConnectionRequest createVpcPeeringConnectionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateRouteTableResult createRouteTable(CreateRouteTableRequest createRouteTableRequest) throws AmazonServiceException, AmazonClientException { + public CreateRouteTableResult createRouteTable(CreateRouteTableRequest createRouteTableRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CancelImportTaskResult cancelImportTask(CancelImportTaskRequest cancelImportTaskRequest) throws AmazonServiceException, AmazonClientException { + public CancelImportTaskResult cancelImportTask(CancelImportTaskRequest cancelImportTaskRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeVolumesResult describeVolumes(DescribeVolumesRequest describeVolumesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVolumesResult describeVolumes(DescribeVolumesRequest describeVolumesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeReservedInstancesListingsResult describeReservedInstancesListings(DescribeReservedInstancesListingsRequest describeReservedInstancesListingsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeReservedInstancesListingsResult describeReservedInstancesListings( + DescribeReservedInstancesListingsRequest describeReservedInstancesListingsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ReportInstanceStatusResult reportInstanceStatus(ReportInstanceStatusRequest reportInstanceStatusRequest) throws AmazonServiceException, AmazonClientException { + public ReportInstanceStatusResult reportInstanceStatus(ReportInstanceStatusRequest reportInstanceStatusRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeRouteTablesResult describeRouteTables(DescribeRouteTablesRequest describeRouteTablesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeRouteTablesResult describeRouteTables(DescribeRouteTablesRequest describeRouteTablesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeDhcpOptionsResult describeDhcpOptions(DescribeDhcpOptionsRequest describeDhcpOptionsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeDhcpOptionsResult describeDhcpOptions(DescribeDhcpOptionsRequest describeDhcpOptionsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override public DescribeEgressOnlyInternetGatewaysResult describeEgressOnlyInternetGateways( - DescribeEgressOnlyInternetGatewaysRequest describeEgressOnlyInternetGatewaysRequest) throws AmazonServiceException, AmazonClientException { + DescribeEgressOnlyInternetGatewaysRequest describeEgressOnlyInternetGatewaysRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public MonitorInstancesResult monitorInstances(MonitorInstancesRequest monitorInstancesRequest) throws AmazonServiceException, AmazonClientException { + public MonitorInstancesResult monitorInstances(MonitorInstancesRequest monitorInstancesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribePrefixListsResult describePrefixLists(DescribePrefixListsRequest describePrefixListsRequest) throws AmazonServiceException, AmazonClientException { + public DescribePrefixListsResult describePrefixLists(DescribePrefixListsRequest describePrefixListsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public RequestSpotFleetResult requestSpotFleet(RequestSpotFleetRequest requestSpotFleetRequest) throws AmazonServiceException, AmazonClientException { + public RequestSpotFleetResult requestSpotFleet(RequestSpotFleetRequest requestSpotFleetRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeImportImageTasksResult describeImportImageTasks(DescribeImportImageTasksRequest describeImportImageTasksRequest) throws AmazonServiceException, AmazonClientException { + public DescribeImportImageTasksResult describeImportImageTasks(DescribeImportImageTasksRequest describeImportImageTasksRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeNetworkAclsResult describeNetworkAcls(DescribeNetworkAclsRequest describeNetworkAclsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeNetworkAclsResult describeNetworkAcls(DescribeNetworkAclsRequest describeNetworkAclsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeBundleTasksResult describeBundleTasks(DescribeBundleTasksRequest describeBundleTasksRequest) throws AmazonServiceException, AmazonClientException { + public DescribeBundleTasksResult describeBundleTasks(DescribeBundleTasksRequest describeBundleTasksRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ImportInstanceResult importInstance(ImportInstanceRequest importInstanceRequest) throws AmazonServiceException, AmazonClientException { + public ImportInstanceResult importInstance(ImportInstanceRequest importInstanceRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteVpcPeeringConnectionResult deleteVpcPeeringConnection(DeleteVpcPeeringConnectionRequest deleteVpcPeeringConnectionRequest) throws AmazonServiceException, AmazonClientException { + public DeleteVpcPeeringConnectionResult deleteVpcPeeringConnection(DeleteVpcPeeringConnectionRequest deleteVpcPeeringConnectionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public GetConsoleOutputResult getConsoleOutput(GetConsoleOutputRequest getConsoleOutputRequest) throws AmazonServiceException, AmazonClientException { + public GetConsoleOutputResult getConsoleOutput(GetConsoleOutputRequest getConsoleOutputRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public GetConsoleScreenshotResult getConsoleScreenshot(GetConsoleScreenshotRequest getConsoleScreenshotRequest) throws AmazonServiceException, AmazonClientException { + public GetConsoleScreenshotResult getConsoleScreenshot(GetConsoleScreenshotRequest getConsoleScreenshotRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public GetHostReservationPurchasePreviewResult getHostReservationPurchasePreview(GetHostReservationPurchasePreviewRequest getHostReservationPurchasePreviewRequest) throws AmazonServiceException, AmazonClientException { + public GetHostReservationPurchasePreviewResult getHostReservationPurchasePreview( + GetHostReservationPurchasePreviewRequest getHostReservationPurchasePreviewRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateInternetGatewayResult createInternetGateway(CreateInternetGatewayRequest createInternetGatewayRequest) throws AmazonServiceException, AmazonClientException { + public CreateInternetGatewayResult createInternetGateway(CreateInternetGatewayRequest createInternetGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteVpnConnectionRouteResult deleteVpnConnectionRoute(DeleteVpnConnectionRouteRequest deleteVpnConnectionRouteRequest) throws AmazonServiceException, AmazonClientException { + public DeleteVpnConnectionRouteResult deleteVpnConnectionRoute(DeleteVpnConnectionRouteRequest deleteVpnConnectionRouteRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DetachNetworkInterfaceResult detachNetworkInterface(DetachNetworkInterfaceRequest detachNetworkInterfaceRequest) throws AmazonServiceException, AmazonClientException { + public DetachNetworkInterfaceResult detachNetworkInterface(DetachNetworkInterfaceRequest detachNetworkInterfaceRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ModifyImageAttributeResult modifyImageAttribute(ModifyImageAttributeRequest modifyImageAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ModifyImageAttributeResult modifyImageAttribute(ModifyImageAttributeRequest modifyImageAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateCustomerGatewayResult createCustomerGateway(CreateCustomerGatewayRequest createCustomerGatewayRequest) throws AmazonServiceException, AmazonClientException { + public CreateCustomerGatewayResult createCustomerGateway(CreateCustomerGatewayRequest createCustomerGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateEgressOnlyInternetGatewayResult createEgressOnlyInternetGateway(CreateEgressOnlyInternetGatewayRequest createEgressOnlyInternetGatewayRequest) throws AmazonServiceException, AmazonClientException { + public CreateEgressOnlyInternetGatewayResult createEgressOnlyInternetGateway( + CreateEgressOnlyInternetGatewayRequest createEgressOnlyInternetGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateFpgaImageResult createFpgaImage(CreateFpgaImageRequest createFpgaImageRequest) throws AmazonServiceException, AmazonClientException { + public CreateFpgaImageResult createFpgaImage(CreateFpgaImageRequest createFpgaImageRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateNetworkInterfacePermissionResult createNetworkInterfacePermission(CreateNetworkInterfacePermissionRequest createNetworkInterfacePermissionRequest) throws AmazonServiceException, AmazonClientException { + public CreateNetworkInterfacePermissionResult createNetworkInterfacePermission( + CreateNetworkInterfacePermissionRequest createNetworkInterfacePermissionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateDefaultVpcResult createDefaultVpc(CreateDefaultVpcRequest createDefaultVpcRequest) throws AmazonServiceException, AmazonClientException { + public CreateDefaultVpcResult createDefaultVpc(CreateDefaultVpcRequest createDefaultVpcRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateSpotDatafeedSubscriptionResult createSpotDatafeedSubscription(CreateSpotDatafeedSubscriptionRequest createSpotDatafeedSubscriptionRequest) throws AmazonServiceException, AmazonClientException { + public CreateSpotDatafeedSubscriptionResult createSpotDatafeedSubscription( + CreateSpotDatafeedSubscriptionRequest createSpotDatafeedSubscriptionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AttachInternetGatewayResult attachInternetGateway(AttachInternetGatewayRequest attachInternetGatewayRequest) throws AmazonServiceException, AmazonClientException { + public AttachInternetGatewayResult attachInternetGateway(AttachInternetGatewayRequest attachInternetGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteVpnConnectionResult deleteVpnConnection(DeleteVpnConnectionRequest deleteVpnConnectionRequest) throws AmazonServiceException, AmazonClientException { + public DeleteVpnConnectionResult deleteVpnConnection(DeleteVpnConnectionRequest deleteVpnConnectionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeMovingAddressesResult describeMovingAddresses(DescribeMovingAddressesRequest describeMovingAddressesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeMovingAddressesResult describeMovingAddresses(DescribeMovingAddressesRequest describeMovingAddressesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeConversionTasksResult describeConversionTasks(DescribeConversionTasksRequest describeConversionTasksRequest) throws AmazonServiceException, AmazonClientException { + public DescribeConversionTasksResult describeConversionTasks(DescribeConversionTasksRequest describeConversionTasksRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateVpnConnectionResult createVpnConnection(CreateVpnConnectionRequest createVpnConnectionRequest) throws AmazonServiceException, AmazonClientException { + public CreateVpnConnectionResult createVpnConnection(CreateVpnConnectionRequest createVpnConnectionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1269,32 +1399,39 @@ public ImportImageResult importImage(ImportImageRequest importImageRequest) thro } @Override - public DisableVpcClassicLinkResult disableVpcClassicLink(DisableVpcClassicLinkRequest disableVpcClassicLinkRequest) throws AmazonServiceException, AmazonClientException { + public DisableVpcClassicLinkResult disableVpcClassicLink(DisableVpcClassicLinkRequest disableVpcClassicLinkRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DisableVpcClassicLinkDnsSupportResult disableVpcClassicLinkDnsSupport(DisableVpcClassicLinkDnsSupportRequest disableVpcClassicLinkDnsSupportRequest) { + public DisableVpcClassicLinkDnsSupportResult disableVpcClassicLinkDnsSupport( + DisableVpcClassicLinkDnsSupportRequest disableVpcClassicLinkDnsSupportRequest) { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeInstanceAttributeResult describeInstanceAttribute(DescribeInstanceAttributeRequest describeInstanceAttributeRequest) throws AmazonServiceException, AmazonClientException { + public DescribeInstanceAttributeResult describeInstanceAttribute(DescribeInstanceAttributeRequest describeInstanceAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeFlowLogsResult describeFlowLogs(DescribeFlowLogsRequest describeFlowLogsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeFlowLogsResult describeFlowLogs(DescribeFlowLogsRequest describeFlowLogsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeVpcPeeringConnectionsResult describeVpcPeeringConnections(DescribeVpcPeeringConnectionsRequest describeVpcPeeringConnectionsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVpcPeeringConnectionsResult describeVpcPeeringConnections( + DescribeVpcPeeringConnectionsRequest describeVpcPeeringConnectionsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribePlacementGroupsResult describePlacementGroups(DescribePlacementGroupsRequest describePlacementGroupsRequest) throws AmazonServiceException, AmazonClientException { + public DescribePlacementGroupsResult describePlacementGroups(DescribePlacementGroupsRequest describePlacementGroupsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1309,37 +1446,44 @@ public RunScheduledInstancesResult runScheduledInstances(RunScheduledInstancesRe } @Override - public DescribeSubnetsResult describeSubnets(DescribeSubnetsRequest describeSubnetsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSubnetsResult describeSubnets(DescribeSubnetsRequest describeSubnetsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AssociateRouteTableResult associateRouteTable(AssociateRouteTableRequest associateRouteTableRequest) throws AmazonServiceException, AmazonClientException { + public AssociateRouteTableResult associateRouteTable(AssociateRouteTableRequest associateRouteTableRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ModifyVolumeAttributeResult modifyVolumeAttribute(ModifyVolumeAttributeRequest modifyVolumeAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ModifyVolumeAttributeResult modifyVolumeAttribute(ModifyVolumeAttributeRequest modifyVolumeAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteNetworkAclResult deleteNetworkAcl(DeleteNetworkAclRequest deleteNetworkAclRequest) throws AmazonServiceException, AmazonClientException { + public DeleteNetworkAclResult deleteNetworkAcl(DeleteNetworkAclRequest deleteNetworkAclRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeImagesResult describeImages(DescribeImagesRequest describeImagesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeImagesResult describeImages(DescribeImagesRequest describeImagesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public StartInstancesResult startInstances(StartInstancesRequest startInstancesRequest) throws AmazonServiceException, AmazonClientException { + public StartInstancesResult startInstances(StartInstancesRequest startInstancesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ModifyInstanceAttributeResult modifyInstanceAttribute(ModifyInstanceAttributeRequest modifyInstanceAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ModifyInstanceAttributeResult modifyInstanceAttribute(ModifyInstanceAttributeRequest modifyInstanceAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1354,32 +1498,42 @@ public ModifyIdentityIdFormatResult modifyIdentityIdFormat(ModifyIdentityIdForma } @Override - public CancelReservedInstancesListingResult cancelReservedInstancesListing(CancelReservedInstancesListingRequest cancelReservedInstancesListingRequest) throws AmazonServiceException, AmazonClientException { + public CancelReservedInstancesListingResult cancelReservedInstancesListing( + CancelReservedInstancesListingRequest cancelReservedInstancesListingRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteDhcpOptionsResult deleteDhcpOptions(DeleteDhcpOptionsRequest deleteDhcpOptionsRequest) throws AmazonServiceException, AmazonClientException { + public DeleteDhcpOptionsResult deleteDhcpOptions(DeleteDhcpOptionsRequest deleteDhcpOptionsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteEgressOnlyInternetGatewayResult deleteEgressOnlyInternetGateway(DeleteEgressOnlyInternetGatewayRequest deleteEgressOnlyInternetGatewayRequest) throws AmazonServiceException, AmazonClientException { + public DeleteEgressOnlyInternetGatewayResult deleteEgressOnlyInternetGateway( + DeleteEgressOnlyInternetGatewayRequest deleteEgressOnlyInternetGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteNetworkInterfacePermissionResult deleteNetworkInterfacePermission(DeleteNetworkInterfacePermissionRequest deleteNetworkInterfacePermissionRequest) throws AmazonServiceException, AmazonClientException { + public DeleteNetworkInterfacePermissionResult deleteNetworkInterfacePermission( + DeleteNetworkInterfacePermissionRequest deleteNetworkInterfacePermissionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AuthorizeSecurityGroupIngressResult authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressRequest authorizeSecurityGroupIngressRequest) throws AmazonServiceException, AmazonClientException { + public AuthorizeSecurityGroupIngressResult authorizeSecurityGroupIngress( + AuthorizeSecurityGroupIngressRequest authorizeSecurityGroupIngressRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeSpotInstanceRequestsResult describeSpotInstanceRequests(DescribeSpotInstanceRequestsRequest describeSpotInstanceRequestsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSpotInstanceRequestsResult describeSpotInstanceRequests( + DescribeSpotInstanceRequestsRequest describeSpotInstanceRequestsRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1389,12 +1543,14 @@ public CreateVpcResult createVpc(CreateVpcRequest createVpcRequest) throws Amazo } @Override - public DescribeCustomerGatewaysResult describeCustomerGateways(DescribeCustomerGatewaysRequest describeCustomerGatewaysRequest) throws AmazonServiceException, AmazonClientException { + public DescribeCustomerGatewaysResult describeCustomerGateways(DescribeCustomerGatewaysRequest describeCustomerGatewaysRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CancelExportTaskResult cancelExportTask(CancelExportTaskRequest cancelExportTaskRequest) throws AmazonServiceException, AmazonClientException { + public CancelExportTaskResult cancelExportTask(CancelExportTaskRequest cancelExportTaskRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1404,7 +1560,8 @@ public CreateRouteResult createRoute(CreateRouteRequest createRouteRequest) thro } @Override - public CreateVpcEndpointResult createVpcEndpoint(CreateVpcEndpointRequest createVpcEndpointRequest) throws AmazonServiceException, AmazonClientException { + public CreateVpcEndpointResult createVpcEndpoint(CreateVpcEndpointRequest createVpcEndpointRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1414,32 +1571,40 @@ public CopyImageResult copyImage(CopyImageRequest copyImageRequest) throws Amazo } @Override - public DescribeVpcClassicLinkResult describeVpcClassicLink(DescribeVpcClassicLinkRequest describeVpcClassicLinkRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVpcClassicLinkResult describeVpcClassicLink(DescribeVpcClassicLinkRequest describeVpcClassicLinkRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ModifyNetworkInterfaceAttributeResult modifyNetworkInterfaceAttribute(ModifyNetworkInterfaceAttributeRequest modifyNetworkInterfaceAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ModifyNetworkInterfaceAttributeResult modifyNetworkInterfaceAttribute( + ModifyNetworkInterfaceAttributeRequest modifyNetworkInterfaceAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteRouteTableResult deleteRouteTable(DeleteRouteTableRequest deleteRouteTableRequest) throws AmazonServiceException, AmazonClientException { + public DeleteRouteTableResult deleteRouteTable(DeleteRouteTableRequest deleteRouteTableRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeNetworkInterfaceAttributeResult describeNetworkInterfaceAttribute(DescribeNetworkInterfaceAttributeRequest describeNetworkInterfaceAttributeRequest) throws AmazonServiceException, AmazonClientException { + public DescribeNetworkInterfaceAttributeResult describeNetworkInterfaceAttribute( + DescribeNetworkInterfaceAttributeRequest describeNetworkInterfaceAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeClassicLinkInstancesResult describeClassicLinkInstances(DescribeClassicLinkInstancesRequest describeClassicLinkInstancesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeClassicLinkInstancesResult describeClassicLinkInstances( + DescribeClassicLinkInstancesRequest describeClassicLinkInstancesRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public RequestSpotInstancesResult requestSpotInstances(RequestSpotInstancesRequest requestSpotInstancesRequest) throws AmazonServiceException, AmazonClientException { + public RequestSpotInstancesResult requestSpotInstances(RequestSpotInstancesRequest requestSpotInstancesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1449,12 +1614,14 @@ public CreateTagsResult createTags(CreateTagsRequest createTagsRequest) throws A } @Override - public DescribeVolumeAttributeResult describeVolumeAttribute(DescribeVolumeAttributeRequest describeVolumeAttributeRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVolumeAttributeResult describeVolumeAttribute(DescribeVolumeAttributeRequest describeVolumeAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AttachNetworkInterfaceResult attachNetworkInterface(AttachNetworkInterfaceRequest attachNetworkInterfaceRequest) throws AmazonServiceException, AmazonClientException { + public AttachNetworkInterfaceResult attachNetworkInterface(AttachNetworkInterfaceRequest attachNetworkInterfaceRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1469,37 +1636,45 @@ public DescribeTagsResult describeTags(DescribeTagsRequest describeTagsRequest) } @Override - public CancelBundleTaskResult cancelBundleTask(CancelBundleTaskRequest cancelBundleTaskRequest) throws AmazonServiceException, AmazonClientException { + public CancelBundleTaskResult cancelBundleTask(CancelBundleTaskRequest cancelBundleTaskRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DisableVgwRoutePropagationResult disableVgwRoutePropagation(DisableVgwRoutePropagationRequest disableVgwRoutePropagationRequest) throws AmazonServiceException, AmazonClientException { + public DisableVgwRoutePropagationResult disableVgwRoutePropagation(DisableVgwRoutePropagationRequest disableVgwRoutePropagationRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ImportSnapshotResult importSnapshot(ImportSnapshotRequest importSnapshotRequest) throws AmazonServiceException, AmazonClientException { + public ImportSnapshotResult importSnapshot(ImportSnapshotRequest importSnapshotRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CancelSpotInstanceRequestsResult cancelSpotInstanceRequests(CancelSpotInstanceRequestsRequest cancelSpotInstanceRequestsRequest) throws AmazonServiceException, AmazonClientException { + public CancelSpotInstanceRequestsResult cancelSpotInstanceRequests(CancelSpotInstanceRequestsRequest cancelSpotInstanceRequestsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeSpotFleetRequestsResult describeSpotFleetRequests(DescribeSpotFleetRequestsRequest describeSpotFleetRequestsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSpotFleetRequestsResult describeSpotFleetRequests(DescribeSpotFleetRequestsRequest describeSpotFleetRequestsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public PurchaseReservedInstancesOfferingResult purchaseReservedInstancesOffering(PurchaseReservedInstancesOfferingRequest purchaseReservedInstancesOfferingRequest) throws AmazonServiceException, AmazonClientException { + public PurchaseReservedInstancesOfferingResult purchaseReservedInstancesOffering( + PurchaseReservedInstancesOfferingRequest purchaseReservedInstancesOfferingRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public PurchaseScheduledInstancesResult purchaseScheduledInstances(PurchaseScheduledInstancesRequest purchaseScheduledInstancesRequest) { + public PurchaseScheduledInstancesResult purchaseScheduledInstances( + PurchaseScheduledInstancesRequest purchaseScheduledInstancesRequest) { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1509,97 +1684,119 @@ public PurchaseHostReservationResult purchaseHostReservation(PurchaseHostReserva } @Override - public ModifySnapshotAttributeResult modifySnapshotAttribute(ModifySnapshotAttributeRequest modifySnapshotAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ModifySnapshotAttributeResult modifySnapshotAttribute(ModifySnapshotAttributeRequest modifySnapshotAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeReservedInstancesModificationsResult describeReservedInstancesModifications(DescribeReservedInstancesModificationsRequest describeReservedInstancesModificationsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeReservedInstancesModificationsResult describeReservedInstancesModifications( + DescribeReservedInstancesModificationsRequest describeReservedInstancesModificationsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public TerminateInstancesResult terminateInstances(TerminateInstancesRequest terminateInstancesRequest) throws AmazonServiceException, AmazonClientException { + public TerminateInstancesResult terminateInstances(TerminateInstancesRequest terminateInstancesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ModifyVpcEndpointResult modifyVpcEndpoint(ModifyVpcEndpointRequest modifyVpcEndpointRequest) throws AmazonServiceException, AmazonClientException { + public ModifyVpcEndpointResult modifyVpcEndpoint(ModifyVpcEndpointRequest modifyVpcEndpointRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteSpotDatafeedSubscriptionResult deleteSpotDatafeedSubscription(DeleteSpotDatafeedSubscriptionRequest deleteSpotDatafeedSubscriptionRequest) throws AmazonServiceException, AmazonClientException { + public DeleteSpotDatafeedSubscriptionResult deleteSpotDatafeedSubscription( + DeleteSpotDatafeedSubscriptionRequest deleteSpotDatafeedSubscriptionRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteInternetGatewayResult deleteInternetGateway(DeleteInternetGatewayRequest deleteInternetGatewayRequest) throws AmazonServiceException, AmazonClientException { + public DeleteInternetGatewayResult deleteInternetGateway(DeleteInternetGatewayRequest deleteInternetGatewayRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeSnapshotAttributeResult describeSnapshotAttribute(DescribeSnapshotAttributeRequest describeSnapshotAttributeRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSnapshotAttributeResult describeSnapshotAttribute(DescribeSnapshotAttributeRequest describeSnapshotAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ReplaceRouteTableAssociationResult replaceRouteTableAssociation(ReplaceRouteTableAssociationRequest replaceRouteTableAssociationRequest) throws AmazonServiceException, AmazonClientException { + public ReplaceRouteTableAssociationResult replaceRouteTableAssociation( + ReplaceRouteTableAssociationRequest replaceRouteTableAssociationRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeAddressesResult describeAddresses(DescribeAddressesRequest describeAddressesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeAddressesResult describeAddresses(DescribeAddressesRequest describeAddressesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeImageAttributeResult describeImageAttribute(DescribeImageAttributeRequest describeImageAttributeRequest) throws AmazonServiceException, AmazonClientException { + public DescribeImageAttributeResult describeImageAttribute(DescribeImageAttributeRequest describeImageAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeKeyPairsResult describeKeyPairs(DescribeKeyPairsRequest describeKeyPairsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeKeyPairsResult describeKeyPairs(DescribeKeyPairsRequest describeKeyPairsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ConfirmProductInstanceResult confirmProductInstance(ConfirmProductInstanceRequest confirmProductInstanceRequest) throws AmazonServiceException, AmazonClientException { + public ConfirmProductInstanceResult confirmProductInstance(ConfirmProductInstanceRequest confirmProductInstanceRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DisassociateRouteTableResult disassociateRouteTable(DisassociateRouteTableRequest disassociateRouteTableRequest) throws AmazonServiceException, AmazonClientException { + public DisassociateRouteTableResult disassociateRouteTable(DisassociateRouteTableRequest disassociateRouteTableRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DisassociateIamInstanceProfileResult disassociateIamInstanceProfile(DisassociateIamInstanceProfileRequest disassociateIamInstanceProfileRequest) throws AmazonServiceException, AmazonClientException { + public DisassociateIamInstanceProfileResult disassociateIamInstanceProfile( + DisassociateIamInstanceProfileRequest disassociateIamInstanceProfileRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DisassociateVpcCidrBlockResult disassociateVpcCidrBlock(DisassociateVpcCidrBlockRequest disassociateVpcCidrBlockRequest) throws AmazonServiceException, AmazonClientException { + public DisassociateVpcCidrBlockResult disassociateVpcCidrBlock(DisassociateVpcCidrBlockRequest disassociateVpcCidrBlockRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DisassociateSubnetCidrBlockResult disassociateSubnetCidrBlock(DisassociateSubnetCidrBlockRequest disassociateSubnetCidrBlockRequest) throws AmazonServiceException, AmazonClientException { + public DisassociateSubnetCidrBlockResult disassociateSubnetCidrBlock( + DisassociateSubnetCidrBlockRequest disassociateSubnetCidrBlockRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeVpcAttributeResult describeVpcAttribute(DescribeVpcAttributeRequest describeVpcAttributeRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVpcAttributeResult describeVpcAttribute(DescribeVpcAttributeRequest describeVpcAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public RevokeSecurityGroupEgressResult revokeSecurityGroupEgress(RevokeSecurityGroupEgressRequest revokeSecurityGroupEgressRequest) throws AmazonServiceException, AmazonClientException { + public RevokeSecurityGroupEgressResult revokeSecurityGroupEgress(RevokeSecurityGroupEgressRequest revokeSecurityGroupEgressRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteNetworkAclEntryResult deleteNetworkAclEntry(DeleteNetworkAclEntryRequest deleteNetworkAclEntryRequest) throws AmazonServiceException, AmazonClientException { + public DeleteNetworkAclEntryResult deleteNetworkAclEntry(DeleteNetworkAclEntryRequest deleteNetworkAclEntryRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1614,12 +1811,14 @@ public ModifyVolumeResult modifyVolume(ModifyVolumeRequest modifyVolumeRequest) } @Override - public DescribeInstanceStatusResult describeInstanceStatus(DescribeInstanceStatusRequest describeInstanceStatusRequest) throws AmazonServiceException, AmazonClientException { + public DescribeInstanceStatusResult describeInstanceStatus(DescribeInstanceStatusRequest describeInstanceStatusRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeVpnGatewaysResult describeVpnGateways(DescribeVpnGatewaysRequest describeVpnGatewaysRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVpnGatewaysResult describeVpnGateways(DescribeVpnGatewaysRequest describeVpnGatewaysRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1629,57 +1828,71 @@ public CreateSubnetResult createSubnet(CreateSubnetRequest createSubnetRequest) } @Override - public DescribeReservedInstancesOfferingsResult describeReservedInstancesOfferings(DescribeReservedInstancesOfferingsRequest describeReservedInstancesOfferingsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeReservedInstancesOfferingsResult describeReservedInstancesOfferings( + DescribeReservedInstancesOfferingsRequest describeReservedInstancesOfferingsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AssignPrivateIpAddressesResult assignPrivateIpAddresses(AssignPrivateIpAddressesRequest assignPrivateIpAddressesRequest) throws AmazonServiceException, AmazonClientException { + public AssignPrivateIpAddressesResult assignPrivateIpAddresses(AssignPrivateIpAddressesRequest assignPrivateIpAddressesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AssignIpv6AddressesResult assignIpv6Addresses(AssignIpv6AddressesRequest assignIpv6AddressesRequest) throws AmazonServiceException, AmazonClientException { + public AssignIpv6AddressesResult assignIpv6Addresses(AssignIpv6AddressesRequest assignIpv6AddressesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeSpotFleetRequestHistoryResult describeSpotFleetRequestHistory(DescribeSpotFleetRequestHistoryRequest describeSpotFleetRequestHistoryRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSpotFleetRequestHistoryResult describeSpotFleetRequestHistory( + DescribeSpotFleetRequestHistoryRequest describeSpotFleetRequestHistoryRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeleteSnapshotResult deleteSnapshot(DeleteSnapshotRequest deleteSnapshotRequest) throws AmazonServiceException, AmazonClientException { + public DeleteSnapshotResult deleteSnapshot(DeleteSnapshotRequest deleteSnapshotRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ReplaceNetworkAclAssociationResult replaceNetworkAclAssociation(ReplaceNetworkAclAssociationRequest replaceNetworkAclAssociationRequest) throws AmazonServiceException, AmazonClientException { + public ReplaceNetworkAclAssociationResult replaceNetworkAclAssociation( + ReplaceNetworkAclAssociationRequest replaceNetworkAclAssociationRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DisassociateAddressResult disassociateAddress(DisassociateAddressRequest disassociateAddressRequest) throws AmazonServiceException, AmazonClientException { + public DisassociateAddressResult disassociateAddress(DisassociateAddressRequest disassociateAddressRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreatePlacementGroupResult createPlacementGroup(CreatePlacementGroupRequest createPlacementGroupRequest) throws AmazonServiceException, AmazonClientException { + public CreatePlacementGroupResult createPlacementGroup(CreatePlacementGroupRequest createPlacementGroupRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public BundleInstanceResult bundleInstance(BundleInstanceRequest bundleInstanceRequest) throws AmazonServiceException, AmazonClientException { + public BundleInstanceResult bundleInstance(BundleInstanceRequest bundleInstanceRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DeletePlacementGroupResult deletePlacementGroup(DeletePlacementGroupRequest deletePlacementGroupRequest) throws AmazonServiceException, AmazonClientException { + public DeletePlacementGroupResult deletePlacementGroup(DeletePlacementGroupRequest deletePlacementGroupRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ModifySubnetAttributeResult modifySubnetAttribute(ModifySubnetAttributeRequest modifySubnetAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ModifySubnetAttributeResult modifySubnetAttribute(ModifySubnetAttributeRequest modifySubnetAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1694,17 +1907,21 @@ public CopySnapshotResult copySnapshot(CopySnapshotRequest copySnapshotRequest) } @Override - public DescribeVpcEndpointServicesResult describeVpcEndpointServices(DescribeVpcEndpointServicesRequest describeVpcEndpointServicesRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVpcEndpointServicesResult describeVpcEndpointServices( + DescribeVpcEndpointServicesRequest describeVpcEndpointServicesRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public AllocateAddressResult allocateAddress(AllocateAddressRequest allocateAddressRequest) throws AmazonServiceException, AmazonClientException { + public AllocateAddressResult allocateAddress(AllocateAddressRequest allocateAddressRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ReleaseAddressResult releaseAddress(ReleaseAddressRequest releaseAddressRequest) throws AmazonServiceException, AmazonClientException { + public ReleaseAddressResult releaseAddress(ReleaseAddressRequest releaseAddressRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1714,17 +1931,20 @@ public ReleaseHostsResult releaseHosts(ReleaseHostsRequest releaseHostsRequest) } @Override - public ReplaceIamInstanceProfileAssociationResult replaceIamInstanceProfileAssociation(ReplaceIamInstanceProfileAssociationRequest replaceIamInstanceProfileAssociationRequest) { + public ReplaceIamInstanceProfileAssociationResult replaceIamInstanceProfileAssociation( + ReplaceIamInstanceProfileAssociationRequest replaceIamInstanceProfileAssociationRequest) { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ResetInstanceAttributeResult resetInstanceAttribute(ResetInstanceAttributeRequest resetInstanceAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ResetInstanceAttributeResult resetInstanceAttribute(ResetInstanceAttributeRequest resetInstanceAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateKeyPairResult createKeyPair(CreateKeyPairRequest createKeyPairRequest) throws AmazonServiceException, AmazonClientException { + public CreateKeyPairResult createKeyPair(CreateKeyPairRequest createKeyPairRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1734,52 +1954,63 @@ public CreateNatGatewayResult createNatGateway(CreateNatGatewayRequest createNat } @Override - public ReplaceNetworkAclEntryResult replaceNetworkAclEntry(ReplaceNetworkAclEntryRequest replaceNetworkAclEntryRequest) throws AmazonServiceException, AmazonClientException { + public ReplaceNetworkAclEntryResult replaceNetworkAclEntry(ReplaceNetworkAclEntryRequest replaceNetworkAclEntryRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeSnapshotsResult describeSnapshots(DescribeSnapshotsRequest describeSnapshotsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeSnapshotsResult describeSnapshots(DescribeSnapshotsRequest describeSnapshotsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateNetworkAclResult createNetworkAcl(CreateNetworkAclRequest createNetworkAclRequest) throws AmazonServiceException, AmazonClientException { + public CreateNetworkAclResult createNetworkAcl(CreateNetworkAclRequest createNetworkAclRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public RegisterImageResult registerImage(RegisterImageRequest registerImageRequest) throws AmazonServiceException, AmazonClientException { + public RegisterImageResult registerImage(RegisterImageRequest registerImageRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public ResetNetworkInterfaceAttributeResult resetNetworkInterfaceAttribute(ResetNetworkInterfaceAttributeRequest resetNetworkInterfaceAttributeRequest) throws AmazonServiceException, AmazonClientException { + public ResetNetworkInterfaceAttributeResult resetNetworkInterfaceAttribute( + ResetNetworkInterfaceAttributeRequest resetNetworkInterfaceAttributeRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public EnableVpcClassicLinkResult enableVpcClassicLink(EnableVpcClassicLinkRequest enableVpcClassicLinkRequest) throws AmazonServiceException, AmazonClientException { + public EnableVpcClassicLinkResult enableVpcClassicLink(EnableVpcClassicLinkRequest enableVpcClassicLinkRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public EnableVpcClassicLinkDnsSupportResult enableVpcClassicLinkDnsSupport(EnableVpcClassicLinkDnsSupportRequest enableVpcClassicLinkDnsSupportRequest) { + public EnableVpcClassicLinkDnsSupportResult enableVpcClassicLinkDnsSupport( + EnableVpcClassicLinkDnsSupportRequest enableVpcClassicLinkDnsSupportRequest) { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public CreateVpnConnectionRouteResult createVpnConnectionRoute(CreateVpnConnectionRouteRequest createVpnConnectionRouteRequest) throws AmazonServiceException, AmazonClientException { + public CreateVpnConnectionRouteResult createVpnConnectionRoute(CreateVpnConnectionRouteRequest createVpnConnectionRouteRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeVpcEndpointsResult describeVpcEndpoints(DescribeVpcEndpointsRequest describeVpcEndpointsRequest) throws AmazonServiceException, AmazonClientException { + public DescribeVpcEndpointsResult describeVpcEndpoints(DescribeVpcEndpointsRequest describeVpcEndpointsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DetachClassicLinkVpcResult detachClassicLinkVpc(DetachClassicLinkVpcRequest detachClassicLinkVpcRequest) throws AmazonServiceException, AmazonClientException { + public DetachClassicLinkVpcResult detachClassicLinkVpc(DetachClassicLinkVpcRequest detachClassicLinkVpcRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1874,7 +2105,8 @@ public DescribeVolumesResult describeVolumes() throws AmazonServiceException, Am } @Override - public DescribeReservedInstancesListingsResult describeReservedInstancesListings() throws AmazonServiceException, AmazonClientException { + public DescribeReservedInstancesListingsResult describeReservedInstancesListings() + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1884,12 +2116,14 @@ public DescribeRouteTablesResult describeRouteTables() throws AmazonServiceExcep } @Override - public DescribeScheduledInstanceAvailabilityResult describeScheduledInstanceAvailability(DescribeScheduledInstanceAvailabilityRequest describeScheduledInstanceAvailabilityRequest) { + public DescribeScheduledInstanceAvailabilityResult describeScheduledInstanceAvailability( + DescribeScheduledInstanceAvailabilityRequest describeScheduledInstanceAvailabilityRequest) { throw new UnsupportedOperationException("Not supported in mock"); } @Override - public DescribeScheduledInstancesResult describeScheduledInstances(DescribeScheduledInstancesRequest describeScheduledInstancesRequest) { + public DescribeScheduledInstancesResult describeScheduledInstances( + DescribeScheduledInstancesRequest describeScheduledInstancesRequest) { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1919,7 +2153,8 @@ public DescribeBundleTasksResult describeBundleTasks() throws AmazonServiceExcep } @Override - public RevokeSecurityGroupIngressResult revokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest revokeSecurityGroupIngressRequest) throws AmazonServiceException, AmazonClientException { + public RevokeSecurityGroupIngressResult revokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest revokeSecurityGroupIngressRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -1970,7 +2205,8 @@ public DescribeHostsResult describeHosts() { @Override public DescribeIamInstanceProfileAssociationsResult describeIamInstanceProfileAssociations( - DescribeIamInstanceProfileAssociationsRequest describeIamInstanceProfileAssociationsRequest) throws AmazonServiceException, AmazonClientException { + DescribeIamInstanceProfileAssociationsRequest describeIamInstanceProfileAssociationsRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -2025,7 +2261,8 @@ public DescribeVpcClassicLinkResult describeVpcClassicLink() throws AmazonServic } @Override - public DescribeVpcClassicLinkDnsSupportResult describeVpcClassicLinkDnsSupport(DescribeVpcClassicLinkDnsSupportRequest describeVpcClassicLinkDnsSupportRequest) { + public DescribeVpcClassicLinkDnsSupportResult describeVpcClassicLinkDnsSupport( + DescribeVpcClassicLinkDnsSupportRequest describeVpcClassicLinkDnsSupportRequest) { throw new UnsupportedOperationException("Not supported in mock"); } @@ -2050,7 +2287,8 @@ public DescribeSpotFleetRequestsResult describeSpotFleetRequests() throws Amazon } @Override - public DescribeReservedInstancesModificationsResult describeReservedInstancesModifications() throws AmazonServiceException, AmazonClientException { + public DescribeReservedInstancesModificationsResult describeReservedInstancesModifications() + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -2080,7 +2318,8 @@ public DescribeVpnGatewaysResult describeVpnGateways() throws AmazonServiceExcep } @Override - public DescribeReservedInstancesOfferingsResult describeReservedInstancesOfferings() throws AmazonServiceException, AmazonClientException { + public DescribeReservedInstancesOfferingsResult describeReservedInstancesOfferings() + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -2110,7 +2349,8 @@ public DescribeVpcEndpointsResult describeVpcEndpoints() throws AmazonServiceExc } @Override - public DryRunResult dryRun(DryRunSupportedRequest request) throws AmazonServiceException, AmazonClientException { + public DryRunResult dryRun(DryRunSupportedRequest request) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } @@ -2129,7 +2369,8 @@ public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest reques } @Override - public ModifySpotFleetRequestResult modifySpotFleetRequest(ModifySpotFleetRequestRequest modifySpotFleetRequestRequest) throws AmazonServiceException, AmazonClientException { + public ModifySpotFleetRequestResult modifySpotFleetRequest(ModifySpotFleetRequestRequest modifySpotFleetRequestRequest) + throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); } } diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java index b135fbfbc8e92..d884ab0cb97ef 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java @@ -45,7 +45,8 @@ *
{@code bucket}
S3 bucket
*
{@code base_path}
Specifies the path within bucket to repository data. Defaults to root directory.
*
{@code concurrent_streams}
Number of concurrent read/write stream (per repository on each node). Defaults to 5.
- *
{@code chunk_size}
Large file can be divided into chunks. This parameter specifies the chunk size. Defaults to not chucked.
+ *
{@code chunk_size}
+ *
Large file can be divided into chunks. This parameter specifies the chunk size. Defaults to not chucked.
*
{@code compress}
If set to true metadata files will be stored compressed. Defaults to false.
* */ diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/AmazonS3Wrapper.java b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/AmazonS3Wrapper.java index 91b364011b80a..c50e15f7daff3 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/AmazonS3Wrapper.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/AmazonS3Wrapper.java @@ -143,12 +143,14 @@ public void setS3ClientOptions(S3ClientOptions clientOptions) { } @Override - public void changeObjectStorageClass(String bucketName, String key, StorageClass newStorageClass) throws AmazonClientException, AmazonServiceException { + public void changeObjectStorageClass(String bucketName, String key, StorageClass newStorageClass) + throws AmazonClientException, AmazonServiceException { delegate.changeObjectStorageClass(bucketName, key, newStorageClass); } @Override - public void setObjectRedirectLocation(String bucketName, String key, String newRedirectLocation) throws AmazonClientException, AmazonServiceException { + public void setObjectRedirectLocation(String bucketName, String key, String newRedirectLocation) + throws AmazonClientException, AmazonServiceException { delegate.setObjectRedirectLocation(bucketName, key, newRedirectLocation); } @@ -178,12 +180,14 @@ public VersionListing listVersions(String bucketName, String prefix) throws Amaz } @Override - public VersionListing listNextBatchOfVersions(VersionListing previousVersionListing) throws AmazonClientException, AmazonServiceException { + public VersionListing listNextBatchOfVersions(VersionListing previousVersionListing) + throws AmazonClientException, AmazonServiceException { return delegate.listNextBatchOfVersions(previousVersionListing); } @Override - public VersionListing listVersions(String bucketName, String prefix, String keyMarker, String versionIdMarker, String delimiter, Integer maxResults) throws AmazonClientException, AmazonServiceException { + public VersionListing listVersions(String bucketName, String prefix, String keyMarker, String versionIdMarker, + String delimiter, Integer maxResults) throws AmazonClientException, AmazonServiceException { return delegate.listVersions(bucketName, prefix, keyMarker, versionIdMarker, delimiter, maxResults); } @@ -218,7 +222,8 @@ public String getBucketLocation(String bucketName) throws AmazonClientException, } @Override - public String getBucketLocation(GetBucketLocationRequest getBucketLocationRequest) throws AmazonClientException, AmazonServiceException { + public String getBucketLocation(GetBucketLocationRequest getBucketLocationRequest) + throws AmazonClientException, AmazonServiceException { return delegate.getBucketLocation(getBucketLocationRequest); } @@ -233,7 +238,8 @@ public Bucket createBucket(String bucketName) throws AmazonClientException, Amaz } @Override - public Bucket createBucket(String bucketName, com.amazonaws.services.s3.model.Region region) throws AmazonClientException, AmazonServiceException { + public Bucket createBucket(String bucketName, com.amazonaws.services.s3.model.Region region) + throws AmazonClientException, AmazonServiceException { return delegate.createBucket(bucketName, region); } @@ -248,7 +254,8 @@ public AccessControlList getObjectAcl(String bucketName, String key) throws Amaz } @Override - public AccessControlList getObjectAcl(String bucketName, String key, String versionId) throws AmazonClientException, AmazonServiceException { + public AccessControlList getObjectAcl(String bucketName, String key, String versionId) + throws AmazonClientException, AmazonServiceException { return delegate.getObjectAcl(bucketName, key, versionId); } @@ -263,17 +270,20 @@ public void setObjectAcl(String bucketName, String key, AccessControlList acl) t } @Override - public void setObjectAcl(String bucketName, String key, CannedAccessControlList acl) throws AmazonClientException, AmazonServiceException { + public void setObjectAcl(String bucketName, String key, CannedAccessControlList acl) + throws AmazonClientException, AmazonServiceException { delegate.setObjectAcl(bucketName, key, acl); } @Override - public void setObjectAcl(String bucketName, String key, String versionId, AccessControlList acl) throws AmazonClientException, AmazonServiceException { + public void setObjectAcl(String bucketName, String key, String versionId, AccessControlList acl) + throws AmazonClientException, AmazonServiceException { delegate.setObjectAcl(bucketName, key, versionId, acl); } @Override - public void setObjectAcl(String bucketName, String key, String versionId, CannedAccessControlList acl) throws AmazonClientException, AmazonServiceException { + public void setObjectAcl(String bucketName, String key, String versionId, CannedAccessControlList acl) + throws AmazonClientException, AmazonServiceException { delegate.setObjectAcl(bucketName, key, versionId, acl); } @@ -313,7 +323,8 @@ public ObjectMetadata getObjectMetadata(String bucketName, String key) throws Am } @Override - public ObjectMetadata getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest) throws AmazonClientException, AmazonServiceException { + public ObjectMetadata getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest) + throws AmazonClientException, AmazonServiceException { return delegate.getObjectMetadata(getObjectMetadataRequest); } @@ -328,7 +339,8 @@ public S3Object getObject(GetObjectRequest getObjectRequest) throws AmazonClient } @Override - public ObjectMetadata getObject(GetObjectRequest getObjectRequest, File destinationFile) throws AmazonClientException, AmazonServiceException { + public ObjectMetadata getObject(GetObjectRequest getObjectRequest, File destinationFile) + throws AmazonClientException, AmazonServiceException { return delegate.getObject(getObjectRequest, destinationFile); } @@ -343,17 +355,20 @@ public void deleteBucket(String bucketName) throws AmazonClientException, Amazon } @Override - public void setBucketReplicationConfiguration(String bucketName, BucketReplicationConfiguration configuration) throws AmazonServiceException, AmazonClientException { + public void setBucketReplicationConfiguration(String bucketName, BucketReplicationConfiguration configuration) + throws AmazonServiceException, AmazonClientException { delegate.setBucketReplicationConfiguration(bucketName, configuration); } @Override - public void setBucketReplicationConfiguration(SetBucketReplicationConfigurationRequest setBucketReplicationConfigurationRequest) throws AmazonServiceException, AmazonClientException { + public void setBucketReplicationConfiguration(SetBucketReplicationConfigurationRequest setBucketReplicationConfigurationRequest) + throws AmazonServiceException, AmazonClientException { delegate.setBucketReplicationConfiguration(setBucketReplicationConfigurationRequest); } @Override - public BucketReplicationConfiguration getBucketReplicationConfiguration(String bucketName) throws AmazonServiceException, AmazonClientException { + public BucketReplicationConfiguration getBucketReplicationConfiguration(String bucketName) + throws AmazonServiceException, AmazonClientException { return delegate.getBucketReplicationConfiguration(bucketName); } @@ -363,8 +378,8 @@ public void deleteBucketReplicationConfiguration(String bucketName) throws Amazo } @Override - public void deleteBucketReplicationConfiguration(DeleteBucketReplicationConfigurationRequest request) throws AmazonServiceException, - AmazonClientException { + public void deleteBucketReplicationConfiguration(DeleteBucketReplicationConfigurationRequest request) + throws AmazonServiceException, AmazonClientException { delegate.deleteBucketReplicationConfiguration(request); } @@ -384,12 +399,14 @@ public PutObjectResult putObject(String bucketName, String key, File file) throw } @Override - public PutObjectResult putObject(String bucketName, String key, InputStream input, ObjectMetadata metadata) throws AmazonClientException, AmazonServiceException { + public PutObjectResult putObject(String bucketName, String key, InputStream input, ObjectMetadata metadata) + throws AmazonClientException, AmazonServiceException { return delegate.putObject(bucketName, key, input, metadata); } @Override - public CopyObjectResult copyObject(String sourceBucketName, String sourceKey, String destinationBucketName, String destinationKey) throws AmazonClientException, AmazonServiceException { + public CopyObjectResult copyObject(String sourceBucketName, String sourceKey, String destinationBucketName, String destinationKey) + throws AmazonClientException, AmazonServiceException { return delegate.copyObject(sourceBucketName, sourceKey, destinationBucketName, destinationKey); } @@ -414,7 +431,8 @@ public void deleteObject(DeleteObjectRequest deleteObjectRequest) throws AmazonC } @Override - public DeleteObjectsResult deleteObjects(DeleteObjectsRequest deleteObjectsRequest) throws AmazonClientException, AmazonServiceException { + public DeleteObjectsResult deleteObjects(DeleteObjectsRequest deleteObjectsRequest) + throws AmazonClientException, AmazonServiceException { return delegate.deleteObjects(deleteObjectsRequest); } @@ -429,22 +447,26 @@ public void deleteVersion(DeleteVersionRequest deleteVersionRequest) throws Amaz } @Override - public BucketLoggingConfiguration getBucketLoggingConfiguration(String bucketName) throws AmazonClientException, AmazonServiceException { + public BucketLoggingConfiguration getBucketLoggingConfiguration(String bucketName) + throws AmazonClientException, AmazonServiceException { return delegate.getBucketLoggingConfiguration(bucketName); } @Override - public void setBucketLoggingConfiguration(SetBucketLoggingConfigurationRequest setBucketLoggingConfigurationRequest) throws AmazonClientException, AmazonServiceException { + public void setBucketLoggingConfiguration(SetBucketLoggingConfigurationRequest setBucketLoggingConfigurationRequest) + throws AmazonClientException, AmazonServiceException { delegate.setBucketLoggingConfiguration(setBucketLoggingConfigurationRequest); } @Override - public BucketVersioningConfiguration getBucketVersioningConfiguration(String bucketName) throws AmazonClientException, AmazonServiceException { + public BucketVersioningConfiguration getBucketVersioningConfiguration(String bucketName) + throws AmazonClientException, AmazonServiceException { return delegate.getBucketVersioningConfiguration(bucketName); } @Override - public void setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest setBucketVersioningConfigurationRequest) throws AmazonClientException, AmazonServiceException { + public void setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest setBucketVersioningConfigurationRequest) + throws AmazonClientException, AmazonServiceException { delegate.setBucketVersioningConfiguration(setBucketVersioningConfigurationRequest); } @@ -494,7 +516,8 @@ public void deleteBucketCrossOriginConfiguration(String bucketName) { } @Override - public void deleteBucketCrossOriginConfiguration(DeleteBucketCrossOriginConfigurationRequest deleteBucketCrossOriginConfigurationRequest) { + public void deleteBucketCrossOriginConfiguration( + DeleteBucketCrossOriginConfigurationRequest deleteBucketCrossOriginConfigurationRequest) { delegate.deleteBucketCrossOriginConfiguration(deleteBucketCrossOriginConfigurationRequest); } @@ -524,37 +547,45 @@ public void deleteBucketTaggingConfiguration(DeleteBucketTaggingConfigurationReq } @Override - public BucketNotificationConfiguration getBucketNotificationConfiguration(String bucketName) throws AmazonClientException, AmazonServiceException { + public BucketNotificationConfiguration getBucketNotificationConfiguration(String bucketName) + throws AmazonClientException, AmazonServiceException { return delegate.getBucketNotificationConfiguration(bucketName); } @Override - public void setBucketNotificationConfiguration(SetBucketNotificationConfigurationRequest setBucketNotificationConfigurationRequest) throws AmazonClientException, AmazonServiceException { + public void setBucketNotificationConfiguration(SetBucketNotificationConfigurationRequest setBucketNotificationConfigurationRequest) + throws AmazonClientException, AmazonServiceException { delegate.setBucketNotificationConfiguration(setBucketNotificationConfigurationRequest); } @Override - public void setBucketNotificationConfiguration(String bucketName, BucketNotificationConfiguration bucketNotificationConfiguration) throws AmazonClientException, AmazonServiceException { + public void setBucketNotificationConfiguration(String bucketName, BucketNotificationConfiguration bucketNotificationConfiguration) + throws AmazonClientException, AmazonServiceException { delegate.setBucketNotificationConfiguration(bucketName, bucketNotificationConfiguration); } @Override - public BucketWebsiteConfiguration getBucketWebsiteConfiguration(String bucketName) throws AmazonClientException, AmazonServiceException { + public BucketWebsiteConfiguration getBucketWebsiteConfiguration(String bucketName) + throws AmazonClientException, AmazonServiceException { return delegate.getBucketWebsiteConfiguration(bucketName); } @Override - public BucketWebsiteConfiguration getBucketWebsiteConfiguration(GetBucketWebsiteConfigurationRequest getBucketWebsiteConfigurationRequest) throws AmazonClientException, AmazonServiceException { + public BucketWebsiteConfiguration getBucketWebsiteConfiguration( + GetBucketWebsiteConfigurationRequest getBucketWebsiteConfigurationRequest) + throws AmazonClientException, AmazonServiceException { return delegate.getBucketWebsiteConfiguration(getBucketWebsiteConfigurationRequest); } @Override - public void setBucketWebsiteConfiguration(String bucketName, BucketWebsiteConfiguration configuration) throws AmazonClientException, AmazonServiceException { + public void setBucketWebsiteConfiguration(String bucketName, BucketWebsiteConfiguration configuration) + throws AmazonClientException, AmazonServiceException { delegate.setBucketWebsiteConfiguration(bucketName, configuration); } @Override - public void setBucketWebsiteConfiguration(SetBucketWebsiteConfigurationRequest setBucketWebsiteConfigurationRequest) throws AmazonClientException, AmazonServiceException { + public void setBucketWebsiteConfiguration(SetBucketWebsiteConfigurationRequest setBucketWebsiteConfigurationRequest) + throws AmazonClientException, AmazonServiceException { delegate.setBucketWebsiteConfiguration(setBucketWebsiteConfigurationRequest); } @@ -564,7 +595,8 @@ public void deleteBucketWebsiteConfiguration(String bucketName) throws AmazonCli } @Override - public void deleteBucketWebsiteConfiguration(DeleteBucketWebsiteConfigurationRequest deleteBucketWebsiteConfigurationRequest) throws AmazonClientException, AmazonServiceException { + public void deleteBucketWebsiteConfiguration(DeleteBucketWebsiteConfigurationRequest deleteBucketWebsiteConfigurationRequest) + throws AmazonClientException, AmazonServiceException { delegate.deleteBucketWebsiteConfiguration(deleteBucketWebsiteConfigurationRequest); } @@ -574,7 +606,8 @@ public BucketPolicy getBucketPolicy(String bucketName) throws AmazonClientExcept } @Override - public BucketPolicy getBucketPolicy(GetBucketPolicyRequest getBucketPolicyRequest) throws AmazonClientException, AmazonServiceException { + public BucketPolicy getBucketPolicy(GetBucketPolicyRequest getBucketPolicyRequest) + throws AmazonClientException, AmazonServiceException { return delegate.getBucketPolicy(getBucketPolicyRequest); } @@ -594,7 +627,8 @@ public void deleteBucketPolicy(String bucketName) throws AmazonClientException, } @Override - public void deleteBucketPolicy(DeleteBucketPolicyRequest deleteBucketPolicyRequest) throws AmazonClientException, AmazonServiceException { + public void deleteBucketPolicy(DeleteBucketPolicyRequest deleteBucketPolicyRequest) + throws AmazonClientException, AmazonServiceException { delegate.deleteBucketPolicy(deleteBucketPolicyRequest); } @@ -614,7 +648,8 @@ public URL generatePresignedUrl(GeneratePresignedUrlRequest generatePresignedUrl } @Override - public InitiateMultipartUploadResult initiateMultipartUpload(InitiateMultipartUploadRequest request) throws AmazonClientException, AmazonServiceException { + public InitiateMultipartUploadResult initiateMultipartUpload(InitiateMultipartUploadRequest request) + throws AmazonClientException, AmazonServiceException { return delegate.initiateMultipartUpload(request); } @@ -634,12 +669,14 @@ public void abortMultipartUpload(AbortMultipartUploadRequest request) throws Ama } @Override - public CompleteMultipartUploadResult completeMultipartUpload(CompleteMultipartUploadRequest request) throws AmazonClientException, AmazonServiceException { + public CompleteMultipartUploadResult completeMultipartUpload(CompleteMultipartUploadRequest request) + throws AmazonClientException, AmazonServiceException { return delegate.completeMultipartUpload(request); } @Override - public MultipartUploadListing listMultipartUploads(ListMultipartUploadsRequest request) throws AmazonClientException, AmazonServiceException { + public MultipartUploadListing listMultipartUploads(ListMultipartUploadsRequest request) + throws AmazonClientException, AmazonServiceException { return delegate.listMultipartUploads(request); } @@ -674,12 +711,14 @@ public boolean isRequesterPaysEnabled(String bucketName) throws AmazonServiceExc } @Override - public ObjectListing listNextBatchOfObjects(ListNextBatchOfObjectsRequest listNextBatchOfObjectsRequest) throws AmazonClientException, AmazonServiceException { + public ObjectListing listNextBatchOfObjects(ListNextBatchOfObjectsRequest listNextBatchOfObjectsRequest) + throws AmazonClientException, AmazonServiceException { return delegate.listNextBatchOfObjects(listNextBatchOfObjectsRequest); } @Override - public VersionListing listNextBatchOfVersions(ListNextBatchOfVersionsRequest listNextBatchOfVersionsRequest) throws AmazonClientException, AmazonServiceException { + public VersionListing listNextBatchOfVersions(ListNextBatchOfVersionsRequest listNextBatchOfVersionsRequest) + throws AmazonClientException, AmazonServiceException { return delegate.listNextBatchOfVersions(listNextBatchOfVersionsRequest); } @@ -689,37 +728,48 @@ public Owner getS3AccountOwner(GetS3AccountOwnerRequest getS3AccountOwnerRequest } @Override - public BucketLoggingConfiguration getBucketLoggingConfiguration(GetBucketLoggingConfigurationRequest getBucketLoggingConfigurationRequest) throws AmazonClientException, AmazonServiceException { + public BucketLoggingConfiguration getBucketLoggingConfiguration( + GetBucketLoggingConfigurationRequest getBucketLoggingConfigurationRequest) + throws AmazonClientException, AmazonServiceException { return delegate.getBucketLoggingConfiguration(getBucketLoggingConfigurationRequest); } @Override - public BucketVersioningConfiguration getBucketVersioningConfiguration(GetBucketVersioningConfigurationRequest getBucketVersioningConfigurationRequest) throws AmazonClientException, AmazonServiceException { + public BucketVersioningConfiguration getBucketVersioningConfiguration( + GetBucketVersioningConfigurationRequest getBucketVersioningConfigurationRequest) + throws AmazonClientException, AmazonServiceException { return delegate.getBucketVersioningConfiguration(getBucketVersioningConfigurationRequest); } @Override - public BucketLifecycleConfiguration getBucketLifecycleConfiguration(GetBucketLifecycleConfigurationRequest getBucketLifecycleConfigurationRequest) { + public BucketLifecycleConfiguration getBucketLifecycleConfiguration( + GetBucketLifecycleConfigurationRequest getBucketLifecycleConfigurationRequest) { return delegate.getBucketLifecycleConfiguration(getBucketLifecycleConfigurationRequest); } @Override - public BucketCrossOriginConfiguration getBucketCrossOriginConfiguration(GetBucketCrossOriginConfigurationRequest getBucketCrossOriginConfigurationRequest) { + public BucketCrossOriginConfiguration getBucketCrossOriginConfiguration( + GetBucketCrossOriginConfigurationRequest getBucketCrossOriginConfigurationRequest) { return delegate.getBucketCrossOriginConfiguration(getBucketCrossOriginConfigurationRequest); } @Override - public BucketTaggingConfiguration getBucketTaggingConfiguration(GetBucketTaggingConfigurationRequest getBucketTaggingConfigurationRequest) { + public BucketTaggingConfiguration getBucketTaggingConfiguration( + GetBucketTaggingConfigurationRequest getBucketTaggingConfigurationRequest) { return delegate.getBucketTaggingConfiguration(getBucketTaggingConfigurationRequest); } @Override - public BucketNotificationConfiguration getBucketNotificationConfiguration(GetBucketNotificationConfigurationRequest getBucketNotificationConfigurationRequest) throws AmazonClientException, AmazonServiceException { + public BucketNotificationConfiguration getBucketNotificationConfiguration( + GetBucketNotificationConfigurationRequest getBucketNotificationConfigurationRequest) + throws AmazonClientException, AmazonServiceException { return delegate.getBucketNotificationConfiguration(getBucketNotificationConfigurationRequest); } @Override - public BucketReplicationConfiguration getBucketReplicationConfiguration(GetBucketReplicationConfigurationRequest getBucketReplicationConfigurationRequest) throws AmazonServiceException, AmazonClientException { + public BucketReplicationConfiguration getBucketReplicationConfiguration( + GetBucketReplicationConfigurationRequest getBucketReplicationConfigurationRequest) + throws AmazonServiceException, AmazonClientException { return delegate.getBucketReplicationConfiguration(getBucketReplicationConfigurationRequest); } From bbf87de1865c7e3f54d6246b6aa4d9320fcd3874 Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Thu, 18 Oct 2018 10:49:23 -0400 Subject: [PATCH 07/17] Fix line longer than 140 characters in Murmur3FieldMapper --- .../elasticsearch/index/mapper/murmur3/Murmur3FieldMapper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/mapper-murmur3/src/main/java/org/elasticsearch/index/mapper/murmur3/Murmur3FieldMapper.java b/plugins/mapper-murmur3/src/main/java/org/elasticsearch/index/mapper/murmur3/Murmur3FieldMapper.java index 50af824fae9bd..cf2b05fe54d90 100644 --- a/plugins/mapper-murmur3/src/main/java/org/elasticsearch/index/mapper/murmur3/Murmur3FieldMapper.java +++ b/plugins/mapper-murmur3/src/main/java/org/elasticsearch/index/mapper/murmur3/Murmur3FieldMapper.java @@ -81,7 +81,8 @@ protected void setupFieldType(BuilderContext context) { public static class TypeParser implements Mapper.TypeParser { @Override - public Mapper.Builder parse(String name, Map node, ParserContext parserContext) throws MapperParsingException { + public Mapper.Builder parse(String name, Map node, ParserContext parserContext) + throws MapperParsingException { Builder builder = new Builder(name); // tweaking these settings is no longer allowed, the entire purpose of murmur3 fields is to store a hash From 00b832afb33f0c1025c3e035a0f17be5aede3233 Mon Sep 17 00:00:00 2001 From: Benjamin Trent Date: Thu, 18 Oct 2018 09:57:20 -0500 Subject: [PATCH 08/17] Fixing line lengths in murmur3 and hdfs plugins (#34603) --- .../repositories/hdfs/HdfsRepository.java | 9 ++++- .../repositories/hdfs/HdfsTests.java | 37 ++++++++++++++++--- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java index 97285f9cecb0d..93ac0550fbc5c 100644 --- a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java +++ b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java @@ -82,7 +82,9 @@ public HdfsRepository(RepositoryMetaData metadata, Environment environment, uri = URI.create(uriSetting); if ("hdfs".equalsIgnoreCase(uri.getScheme()) == false) { throw new IllegalArgumentException(String.format(Locale.ROOT, - "Invalid scheme [%s] specified in uri [%s]; only 'hdfs' uri allowed for hdfs snapshot/restore", uri.getScheme(), uriSetting)); + "Invalid scheme [%s] specified in uri [%s]; only 'hdfs' uri allowed for hdfs snapshot/restore", + uri.getScheme(), + uriSetting)); } if (Strings.hasLength(uri.getPath()) && uri.getPath().equals("/") == false) { throw new IllegalArgumentException(String.format(Locale.ROOT, @@ -134,7 +136,10 @@ private HdfsBlobStore createBlobstore(URI uri, String path, Settings repositoryS } }); - logger.debug("Using file-system [{}] for URI [{}], path [{}]", fileContext.getDefaultFileSystem(), fileContext.getDefaultFileSystem().getUri(), path); + logger.debug("Using file-system [{}] for URI [{}], path [{}]", + fileContext.getDefaultFileSystem(), + fileContext.getDefaultFileSystem().getUri(), + path); try { return new HdfsBlobStore(fileContext, path, bufferSize, isReadOnly(), haEnabled); diff --git a/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java index 5c5ab4ee42692..9a0a590efe8d6 100644 --- a/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java +++ b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java @@ -76,11 +76,25 @@ public void testSimpleWorkflow() { assertThat(count(client, "test-idx-3"), equalTo(100L)); logger.info("--> snapshot"); - CreateSnapshotResponse createSnapshotResponse = client.admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx-*", "-test-idx-3").get(); + CreateSnapshotResponse createSnapshotResponse = client.admin() + .cluster() + .prepareCreateSnapshot("test-repo", "test-snap") + .setWaitForCompletion(true) + .setIndices("test-idx-*", "-test-idx-3") + .get(); assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), greaterThan(0)); - assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponse.getSnapshotInfo().totalShards())); - - assertThat(client.admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").get().getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS)); + assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), + equalTo(createSnapshotResponse.getSnapshotInfo().totalShards())); + + assertThat(client.admin() + .cluster() + .prepareGetSnapshots("test-repo") + .setSnapshots("test-snap") + .get() + .getSnapshots() + .get(0) + .state(), + equalTo(SnapshotState.SUCCESS)); logger.info("--> delete some data"); for (int i = 0; i < 50; i++) { @@ -101,7 +115,12 @@ public void testSimpleWorkflow() { client.admin().indices().prepareClose("test-idx-1", "test-idx-2").get(); logger.info("--> restore all indices from the snapshot"); - RestoreSnapshotResponse restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet(); + RestoreSnapshotResponse restoreSnapshotResponse = client.admin() + .cluster() + .prepareRestoreSnapshot("test-repo", "test-snap") + .setWaitForCompletion(true) + .execute() + .actionGet(); assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0)); ensureGreen(); @@ -113,7 +132,13 @@ public void testSimpleWorkflow() { logger.info("--> delete indices"); client().admin().indices().prepareDelete("test-idx-1", "test-idx-2").get(); logger.info("--> restore one index after deletion"); - restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx-*", "-test-idx-2").execute().actionGet(); + restoreSnapshotResponse = client.admin() + .cluster() + .prepareRestoreSnapshot("test-repo", "test-snap") + .setWaitForCompletion(true) + .setIndices("test-idx-*", "-test-idx-2") + .execute() + .actionGet(); assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0)); ensureGreen(); assertThat(count(client, "test-idx-1"), equalTo(100L)); From 56cd0de57c6778054c84f2d901341ee061b06901 Mon Sep 17 00:00:00 2001 From: Ioannis Kakavas Date: Thu, 18 Oct 2018 18:22:46 +0300 Subject: [PATCH 09/17] Change wording for FIPS 140-2 (#34471) Changes wording in the FIPS 140-2 related documentation. Co-authored-by: derickson --- x-pack/docs/en/security/fips-140-compliance.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/docs/en/security/fips-140-compliance.asciidoc b/x-pack/docs/en/security/fips-140-compliance.asciidoc index ceb605c2e2db1..0216e61784cdb 100644 --- a/x-pack/docs/en/security/fips-140-compliance.asciidoc +++ b/x-pack/docs/en/security/fips-140-compliance.asciidoc @@ -9,7 +9,7 @@ government computer security standard used to approve cryptographic modules. enabled JVM. In order to set {es} in fips mode, you must set the `xpack.security.fips_mode.enabled` to `true` in `elasticsearch.yml` -For {es}, FIPS 140-2 compliance is ensured by +For {es}, adherence to FIPS 140-2 is ensured by - Using FIPS approved / NIST recommended cryptographic algorithms. - Delegating the implementation of these cryptographic algorithms to a NIST @@ -125,4 +125,4 @@ features are not available while running in fips mode. The list is as follows: * The SQL CLI client cannot run in a FIPS 140-2 enabled JVM while using TLS for transport security or PKI for client authentication. * The SAML Realm cannot decrypt and consume encrypted Assertions or encrypted - attributes in Attribute Statements from the SAML IdP. \ No newline at end of file + attributes in Attribute Statements from the SAML IdP. From 5ed4a2b296c5da50261cf7809f89b23bada92881 Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Thu, 18 Oct 2018 12:12:17 -0400 Subject: [PATCH 10/17] [Rollup] Add support for date histo `format` (#34537) Adds support for query-time formatting of the date histo keys when executing a rollup search. Closes #34391 --- .../xpack/rollup/RollupRequestTranslator.java | 4 +++ .../rollup/RollupRequestTranslationTests.java | 18 +++++++++++++ .../test/rollup/rollup_search.yml | 26 +++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/RollupRequestTranslator.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/RollupRequestTranslator.java index 44e67cc619cf7..8b028b712e717 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/RollupRequestTranslator.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/RollupRequestTranslator.java @@ -6,6 +6,7 @@ package org.elasticsearch.xpack.rollup; +import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; @@ -227,6 +228,9 @@ private static List translateDateHistogram(DateHistogramAggr if (source.extendedBounds() != null) { rolledDateHisto.extendedBounds(source.extendedBounds()); } + if (Strings.isNullOrEmpty(source.format()) == false) { + rolledDateHisto.format(source.format()); + } rolledDateHisto.keyed(source.keyed()); rolledDateHisto.minDocCount(source.minDocCount()); rolledDateHisto.order(source.order()); diff --git a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/RollupRequestTranslationTests.java b/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/RollupRequestTranslationTests.java index c72808bba3731..1ceac98725e8b 100644 --- a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/RollupRequestTranslationTests.java +++ b/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/RollupRequestTranslationTests.java @@ -108,7 +108,25 @@ public void testBasicDateHisto() { fail("Unexpected query builder in filter conditions"); } } + } + + public void testFormattedDateHisto() { + DateHistogramAggregationBuilder histo = new DateHistogramAggregationBuilder("test_histo"); + histo.dateHistogramInterval(new DateHistogramInterval("1d")) + .field("foo") + .extendedBounds(new ExtendedBounds(0L, 1000L)) + .format("yyyy-MM-dd") + .subAggregation(new MaxAggregationBuilder("the_max").field("max_field")); + List filterConditions = new ArrayList<>(); + + List translated = translateAggregation(histo, filterConditions, namedWriteableRegistry); + assertThat(translated.size(), equalTo(1)); + assertThat(translated.get(0), Matchers.instanceOf(DateHistogramAggregationBuilder.class)); + DateHistogramAggregationBuilder translatedHisto = (DateHistogramAggregationBuilder)translated.get(0); + assertThat(translatedHisto.dateHistogramInterval(), equalTo(new DateHistogramInterval("1d"))); + assertThat(translatedHisto.format(), equalTo("yyyy-MM-dd")); + assertThat(translatedHisto.field(), equalTo("foo.date_histogram.timestamp")); } public void testSimpleMetric() { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/rollup/rollup_search.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/rollup/rollup_search.yml index e2f1174665ea6..3a756efc0d72a 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/rollup/rollup_search.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/rollup/rollup_search.yml @@ -152,6 +152,32 @@ setup: - match: { aggregations.histo.buckets.3.key_as_string: "2017-01-01T08:00:00.000Z" } - match: { aggregations.histo.buckets.3.doc_count: 20 } +--- +"Formatted Date Histo": + + - do: + xpack.rollup.rollup_search: + index: "foo_rollup" + body: + size: 0 + aggs: + histo: + date_histogram: + field: "timestamp" + interval: "1h" + time_zone: "UTC" + format: "yyyy-MM-dd" + + - length: { aggregations.histo.buckets: 4 } + - match: { aggregations.histo.buckets.0.key_as_string: "2017-01-01" } + - match: { aggregations.histo.buckets.0.doc_count: 1 } + - match: { aggregations.histo.buckets.1.key_as_string: "2017-01-01" } + - match: { aggregations.histo.buckets.1.doc_count: 2 } + - match: { aggregations.histo.buckets.2.key_as_string: "2017-01-01" } + - match: { aggregations.histo.buckets.2.doc_count: 10 } + - match: { aggregations.histo.buckets.3.key_as_string: "2017-01-01" } + - match: { aggregations.histo.buckets.3.doc_count: 20 } + --- "Empty aggregation": From fd3b8e07faf931b5c4083391839e47a7d323177b Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Fri, 19 Oct 2018 10:41:21 +0200 Subject: [PATCH 11/17] Address comments --- .../xpack/sql/type/DataType.java | 4 +- .../xpack/sql/analysis/analyzer/Verifier.java | 48 +++++-------------- .../sql/expression/gen/pipeline/Pipe.java | 5 +- .../xpack/sql/expression/predicate/In.java | 41 +++++----------- .../predicate/operator/comparison/InPipe.java | 48 +++++++------------ .../operator/comparison/InProcessor.java | 20 ++++---- .../xpack/sql/optimizer/Optimizer.java | 2 +- .../xpack/sql/planner/QueryTranslator.java | 7 ++- .../xpack/sql/querydsl/query/TermsQuery.java | 14 ++---- .../analyzer/VerifierErrorMessagesTests.java | 4 +- x-pack/qa/sql/src/main/resources/agg.sql-spec | 1 - 11 files changed, 64 insertions(+), 130 deletions(-) diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java index 0cb2ca840440f..cb52b4c2a5a92 100644 --- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java +++ b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java @@ -174,9 +174,9 @@ public static DataType fromEsType(String esType) { public boolean isCompatibleWith(DataType other) { if (this == other) { return true; - } else if (this.isString() && other.isString()) { + } else if (isString() && other.isString()) { return true; - } else if (this.isNumeric() && other.isNumeric()) { + } else if (isNumeric() && other.isNumeric()) { return true; } else { return false; diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java index 71e114c7a3735..e5ab3ce082b71 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java @@ -12,7 +12,6 @@ import org.elasticsearch.xpack.sql.expression.Expression; import org.elasticsearch.xpack.sql.expression.Expressions; import org.elasticsearch.xpack.sql.expression.FieldAttribute; -import org.elasticsearch.xpack.sql.expression.NamedExpression; import org.elasticsearch.xpack.sql.expression.UnresolvedAttribute; import org.elasticsearch.xpack.sql.expression.function.Function; import org.elasticsearch.xpack.sql.expression.function.FunctionAttribute; @@ -25,7 +24,6 @@ import org.elasticsearch.xpack.sql.plan.logical.Filter; import org.elasticsearch.xpack.sql.plan.logical.LogicalPlan; import org.elasticsearch.xpack.sql.plan.logical.OrderBy; -import org.elasticsearch.xpack.sql.plan.logical.Project; import org.elasticsearch.xpack.sql.tree.Node; import org.elasticsearch.xpack.sql.type.DataType; import org.elasticsearch.xpack.sql.util.StringUtils; @@ -193,15 +191,7 @@ static Collection verify(LogicalPlan plan) { Set localFailures = new LinkedHashSet<>(); - if (p instanceof Filter) { - Filter filterPlan = (Filter) p; - validateInExpression(filterPlan.condition(), localFailures); - } else if (p instanceof Project) { - Project projectPlan = (Project) p; - for (NamedExpression ne : projectPlan.projections()) { - validateInExpression(ne, localFailures); - } - } + validateInExpression(p, localFailures); if (!groupingFailures.contains(p)) { checkGroupBy(p, localFailures, resolvedFunctions, groupingFailures); @@ -504,30 +494,18 @@ private static void checkNestedUsedInGroupByOrHaving(LogicalPlan p, Set } } - private static void validateInExpression(Expression e, Set localFailures) { - if (e instanceof In) { - In in = (In) e; - DataType dt = null; - for (Expression rightValue : in.list()) { - if (dt == null) { - dt = rightValue.dataType(); - if (!in.value().dataType().isCompatibleWith(dt)) { - localFailures.add(fail(in.list().get(0), "expected data type [%s], value provided is of type [%s]", - in.value().dataType(), dt)); - return; - } - } else { - if (!rightValue.dataType().isCompatibleWith(dt)) { - localFailures.add(fail(rightValue, "expected data type [%s], value provided is of type [%s]", - dt, rightValue.dataType())); - return; + private static void validateInExpression(LogicalPlan p, Set localFailures) { + p.forEachExpressions(e -> + e.forEachUp((In in) -> { + DataType dt = in.value().dataType(); + for (Expression value : in.list()) { + if (!in.value().dataType().isCompatibleWith(value.dataType())) { + localFailures.add(fail(value, "expected data type [%s], value provided is of type [%s]", + dt, value.dataType())); + return; + } } - } - } - } else { - for (Expression child : e.children()) { - validateInExpression(child, localFailures); - } - } + }, + In.class)); } } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/gen/pipeline/Pipe.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/gen/pipeline/Pipe.java index 4d1604ff535d3..5c96d2c9244ab 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/gen/pipeline/Pipe.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/gen/pipeline/Pipe.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.sql.expression.gen.pipeline; +import org.elasticsearch.xpack.sql.capabilities.Resolvable; import org.elasticsearch.xpack.sql.execution.search.FieldExtraction; import org.elasticsearch.xpack.sql.expression.Attribute; import org.elasticsearch.xpack.sql.expression.Expression; @@ -24,7 +25,7 @@ * Is an {@code Add} operator with left {@code ABS} over an aggregate (MAX), and * right being a {@code CAST} function. */ -public abstract class Pipe extends Node implements FieldExtraction { +public abstract class Pipe extends Node implements FieldExtraction, Resolvable { private final Expression expression; @@ -37,8 +38,6 @@ public Expression expression() { return expression; } - public abstract boolean resolved(); - public abstract Processor asProcessor(); /** diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java index 16442e9203111..ae0184ef0616e 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.xpack.sql.expression.predicate; -import org.elasticsearch.xpack.sql.SqlIllegalArgumentException; import org.elasticsearch.xpack.sql.expression.Attribute; import org.elasticsearch.xpack.sql.expression.Expression; import org.elasticsearch.xpack.sql.expression.Expressions; @@ -37,8 +36,6 @@ public class In extends NamedExpression implements ScriptWeaver { private final Expression value; private final List list; - private Boolean lazyNullable, lazyFoldable; - private List foldedList; private Attribute lazyAttribute; public In(Location location, Expression value, List list) { @@ -54,8 +51,8 @@ protected NodeInfo info() { @Override public Expression replaceChildren(List newChildren) { - if (newChildren.isEmpty()) { - throw new IllegalArgumentException("expected one or more children but received [" + newChildren.size() + "]"); + if (newChildren.size() < 2) { + throw new IllegalArgumentException("expected at least [2] children but received [" + newChildren.size() + "]"); } return new In(location(), newChildren.get(newChildren.size() - 1), newChildren.subList(0, newChildren.size() - 1)); } @@ -68,10 +65,6 @@ public List list() { return list; } - public List foldedList() { - return foldedList; - } - @Override public DataType dataType() { return DataType.BOOLEAN; @@ -79,31 +72,20 @@ public DataType dataType() { @Override public boolean nullable() { - if (lazyNullable == null) { - lazyNullable = children().stream().anyMatch(Expression::nullable); - } - return lazyNullable; + return Expressions.nullable(children()); } @Override public boolean foldable() { - if (lazyFoldable == null) { - lazyFoldable = children().stream().allMatch(Expression::foldable) && value.foldable(); - foldedList = new ArrayList<>(list.size()); - list.forEach(e -> foldedList.add(e.foldable() ? e.fold() : e)); - } - return lazyFoldable; + return children().stream().allMatch(Expression::foldable); } @Override public Object fold() { - if (!foldable()) { - throw new SqlIllegalArgumentException("Cannot fold if not everything in `IN` expression is foldable"); - } Object foldedLeftValue = value.fold(); - for (Object rightValue : foldedList) { - Boolean compResult = Comparisons.eq(foldedLeftValue, rightValue); + for (Expression rightValue : list) { + Boolean compResult = Comparisons.eq(foldedLeftValue, rightValue.fold()); if (compResult != null && compResult) { return true; } @@ -133,13 +115,14 @@ public ScriptTemplate asScript() { ScriptTemplate leftScript = asScript(value); List rightParams = new ArrayList<>(); String scriptPrefix = leftScript + "=="; - for (Object e : foldedList) { - if (e instanceof Expression) { - ScriptTemplate rightScript = asScript((Expression) e); + for (Expression e : list) { + Object valueFromList = e.fold(); + if (valueFromList instanceof Expression) { + ScriptTemplate rightScript = asScript((Expression) valueFromList); sj.add(scriptPrefix + rightScript.template()); rightParams.add(rightScript.params()); } else { - if (e instanceof String) { + if (valueFromList instanceof String) { sj.add(scriptPrefix + '"' + e + '"'); } else { sj.add(scriptPrefix + e.toString()); @@ -157,7 +140,7 @@ public ScriptTemplate asScript() { @Override protected Pipe makePipe() { - return new InPipe(location(), this, Expressions.pipe(value()), list.stream().map(Expressions::pipe).collect(Collectors.toList())); + return new InPipe(location(), this, children().stream().map(Expressions::pipe).collect(Collectors.toList())); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InPipe.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InPipe.java index eaf911b78bb93..4ae72b4b49e7a 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InPipe.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InPipe.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.sql.expression.predicate.operator.comparison; +import org.elasticsearch.xpack.sql.capabilities.Resolvables; import org.elasticsearch.xpack.sql.execution.search.FieldExtraction; import org.elasticsearch.xpack.sql.execution.search.SqlSourceBuilder; import org.elasticsearch.xpack.sql.expression.Expression; @@ -16,17 +17,14 @@ import java.util.List; import java.util.Objects; import java.util.stream.Collectors; -import java.util.stream.Stream; public class InPipe extends Pipe { - private Pipe left; - private List right; + private List pipes; - public InPipe(Location location, Expression expression, Pipe left, List right) { - super(location, expression, Stream.concat(Stream.of(left), right.stream()).collect(Collectors.toList())); - this.left = left; - this.right = right; + public InPipe(Location location, Expression expression, List pipes) { + super(location, expression, pipes); + this.pipes = pipes; } @Override @@ -34,52 +32,41 @@ public final Pipe replaceChildren(List newChildren) { if (newChildren.size() < 2) { throw new IllegalArgumentException("expected at least [2] children but received [" + newChildren.size() + "]"); } - left = newChildren.get(0); - return new InPipe(location(), expression(), newChildren.get(0), newChildren.subList(1, newChildren.size())); + return new InPipe(location(), expression(), newChildren); } @Override protected NodeInfo info() { - return NodeInfo.create(this, InPipe::new, expression(), left, right); - } - - public Pipe left() { - return left; - } - - public List right() { - return right; + return NodeInfo.create(this, InPipe::new, expression(), pipes); } @Override public boolean supportedByAggsOnlyQuery() { - return left.supportedByAggsOnlyQuery() && right.stream().allMatch(FieldExtraction::supportedByAggsOnlyQuery); + return pipes.stream().allMatch(FieldExtraction::supportedByAggsOnlyQuery); } @Override public final Pipe resolveAttributes(AttributeResolver resolver) { - Pipe newLeft = left.resolveAttributes(resolver); - List newRight = new ArrayList<>(right.size()); - for (Pipe p : right) { - newRight.add(p.resolveAttributes(resolver)); + List newPipes = new ArrayList<>(pipes.size()); + for (Pipe p : pipes) { + newPipes.add(p.resolveAttributes(resolver)); } - return replaceChildren(Stream.concat(Stream.of(newLeft), newRight.stream()).collect(Collectors.toList())); + return replaceChildren(newPipes); } @Override public boolean resolved() { - return left().resolved() && right().stream().allMatch(Pipe::resolved); + return Resolvables.resolved(pipes); } @Override public final void collectFields(SqlSourceBuilder sourceBuilder) { - left.collectFields(sourceBuilder); - right.forEach(p -> p.collectFields(sourceBuilder)); + pipes.forEach(p -> p.collectFields(sourceBuilder)); } @Override public int hashCode() { - return Objects.hash(left(), right()); + return Objects.hash(pipes); } @Override @@ -93,12 +80,11 @@ public boolean equals(Object obj) { } InPipe other = (InPipe) obj; - return Objects.equals(left(), other.left()) - && Objects.equals(right(), other.right()); + return Objects.equals(pipes, other.pipes); } @Override public InProcessor asProcessor() { - return new InProcessor(left().asProcessor(), right().stream().map(Pipe::asProcessor).collect(Collectors.toList())); + return new InProcessor(pipes.stream().map(Pipe::asProcessor).collect(Collectors.toList())); } } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java index 30efdef09648d..16ef71672b79d 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java @@ -16,17 +16,14 @@ class InProcessor implements Processor { public static final String NAME = "in"; - private final Processor left; - private final List rightList; + private final List processsors; - InProcessor(Processor left, List rightList) { - this.left = left; - this.rightList = rightList; + InProcessor(List processors) { + this.processsors = processors; } InProcessor(StreamInput in) throws IOException { - left = in.readNamedWriteable(Processor.class); - rightList = in.readNamedWriteableList(Processor.class); + processsors = in.readNamedWriteableList(Processor.class); } @Override @@ -36,15 +33,14 @@ public String getWriteableName() { @Override public final void writeTo(StreamOutput out) throws IOException { - out.writeNamedWriteable(left); - out.writeNamedWriteableList(rightList); + out.writeNamedWriteableList(processsors); } @Override public Object process(Object input) { - Object leftValue = left.process(input); - for (Processor p : rightList) { - Boolean compResult = Comparisons.eq(leftValue, p.process(input)); + Object leftValue = processsors.get(0).process(input); + for (int i = 1; i < processsors.size(); i++) { + Boolean compResult = Comparisons.eq(leftValue, processsors.get(i).process(input)); if (compResult != null && compResult) { return true; } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/optimizer/Optimizer.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/optimizer/Optimizer.java index 033d46e1b1b49..ab755e05e08cf 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/optimizer/Optimizer.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/optimizer/Optimizer.java @@ -1892,4 +1892,4 @@ protected LogicalPlan rule(LogicalPlan plan) { enum TransformDirection { UP, DOWN }; -} \ No newline at end of file +} diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java index 3e79932c2b5bf..e3b41e79028b9 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java @@ -87,7 +87,6 @@ import org.elasticsearch.xpack.sql.util.Check; import org.elasticsearch.xpack.sql.util.ReflectionUtils; -import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; @@ -540,7 +539,7 @@ protected QueryTranslation asQuery(BinaryComparison bc, boolean onAggs) { // if the code gets here it's a bug // else { - throw new UnsupportedOperationException("No idea how to translate " + bc.left()); + throw new SqlIllegalArgumentException("No idea how to translate " + bc.left()); } } @@ -612,7 +611,7 @@ protected QueryTranslation asQuery(In in, boolean onAggs) { else { // query directly on the field if (at instanceof FieldAttribute) { - query = wrapIfNested(new TermsQuery(in.location(), ne.name(), new ArrayList<>(in.foldedList())), ne); + query = wrapIfNested(new TermsQuery(in.location(), ne.name(), in.list()), ne); } else { query = new ScriptQuery(at.location(), script); } @@ -623,7 +622,7 @@ protected QueryTranslation asQuery(In in, boolean onAggs) { // if the code gets here it's a bug // else { - throw new UnsupportedOperationException("No idea how to translate " + in.value()); + throw new SqlIllegalArgumentException("No idea how to translate " + in.value()); } } } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java index 799b2fbbe5eed..fb98353c750e5 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java @@ -6,10 +6,12 @@ package org.elasticsearch.xpack.sql.querydsl.query; import org.elasticsearch.index.query.QueryBuilder; +import org.elasticsearch.xpack.sql.expression.Expression; import org.elasticsearch.xpack.sql.tree.Location; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; import static org.elasticsearch.index.query.QueryBuilders.termsQuery; @@ -18,18 +20,10 @@ public class TermsQuery extends LeafQuery { private final String term; private final List values; - public TermsQuery(Location location, String term, List values) { + public TermsQuery(Location location, String term, List values) { super(location); this.term = term; - this.values = values; - } - - public String term() { - return term; - } - - public List values() { - return values; + this.values = values.stream().map(Expression::fold).collect(Collectors.toList()); } @Override diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java index 8fa05c61a6243..db3d92c07cde2 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java @@ -191,12 +191,12 @@ public void testInNestedWithDifferentDataTypesFromLeftValue_SelectClause() { } public void testInWithDifferentDataTypes_WhereClause() { - assertEquals("1:49: expected data type [KEYWORD], value provided is of type [INTEGER]", + assertEquals("1:49: expected data type [TEXT], value provided is of type [INTEGER]", verify("SELECT * FROM test WHERE text IN ('foo', 'bar', 4)")); } public void testInNestedWithDifferentDataTypes_WhereClause() { - assertEquals("1:60: expected data type [KEYWORD], value provided is of type [INTEGER]", + assertEquals("1:60: expected data type [TEXT], value provided is of type [INTEGER]", verify("SELECT * FROM test WHERE int = 1 OR text IN ('foo', 'bar', 2)")); } diff --git a/x-pack/qa/sql/src/main/resources/agg.sql-spec b/x-pack/qa/sql/src/main/resources/agg.sql-spec index 6e520de3e6623..0bd10af8be230 100644 --- a/x-pack/qa/sql/src/main/resources/agg.sql-spec +++ b/x-pack/qa/sql/src/main/resources/agg.sql-spec @@ -415,6 +415,5 @@ SELECT gender, COUNT(DISTINCT languages) AS c FROM test_emp GROUP BY gender HAVI // filter with IN aggMultiWithHavingUsingIn SELECT MIN(salary) min, MAX(salary) max, gender g, COUNT(*) c FROM "test_emp" WHERE languages > 0 GROUP BY g HAVING max IN(74999, 74600) ORDER BY gender; - aggMultiGroupByMultiWithHavingUsingIn SELECT MIN(salary) min, MAX(salary) max, gender g, languages l, COUNT(*) c FROM "test_emp" WHERE languages > 0 GROUP BY g, languages HAVING max IN (74500, 74600) ORDER BY gender, languages; \ No newline at end of file From 7b26347b07b35f00ffbdb917fac5e68b326f6206 Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Fri, 19 Oct 2018 13:25:00 +0200 Subject: [PATCH 12/17] Added docs reference --- docs/reference/sql/functions/operators.asciidoc | 9 ++++++++- x-pack/qa/sql/src/main/resources/filter.sql-spec | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/reference/sql/functions/operators.asciidoc b/docs/reference/sql/functions/operators.asciidoc index 9c90d12320ed0..aae9d47ec7e0d 100644 --- a/docs/reference/sql/functions/operators.asciidoc +++ b/docs/reference/sql/functions/operators.asciidoc @@ -3,7 +3,7 @@ [[sql-operators]] === Comparison Operators -Boolean operator for comparing one or two expressions. +Boolean operator for comparing against one or multiple expressions. * Equality (`=`) @@ -40,6 +40,13 @@ include-tagged::{sql-specs}/filter.sql-spec[whereBetween] include-tagged::{sql-specs}/filter.sql-spec[whereIsNotNullAndIsNull] -------------------------------------------------- +* `IN (, , ...)` + +["source","sql",subs="attributes,callouts,macros"] +-------------------------------------------------- +include-tagged::{sql-specs}/filter.sql-spec[whereWithInAndMultipleValues] +-------------------------------------------------- + [[sql-operators-logical]] === Logical Operators diff --git a/x-pack/qa/sql/src/main/resources/filter.sql-spec b/x-pack/qa/sql/src/main/resources/filter.sql-spec index b0538be0da634..1a564ecb9ad82 100644 --- a/x-pack/qa/sql/src/main/resources/filter.sql-spec +++ b/x-pack/qa/sql/src/main/resources/filter.sql-spec @@ -85,7 +85,9 @@ SELECT last_name l FROM "test_emp" WHERE emp_no NOT BETWEEN 10010 AND 10020 ORDE whereWithInAndOneValue SELECT last_name l FROM "test_emp" WHERE emp_no IN (10001); whereWithInAndMultipleValues +// tag::whereWithInAndMultipleValues SELECT last_name l FROM "test_emp" WHERE emp_no IN (10000, 10001, 10002, 999) ORDER BY emp_no LIMIT 5; +// end::whereWithInAndMultipleValues whereWithInAndOneValueWithNegation SELECT last_name l FROM "test_emp" WHERE emp_no NOT IN (10001) ORDER BY emp_no LIMIT 5; From 27fdd067cdb9a3fc1ec691f16e72a1a685ee7cf7 Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Fri, 19 Oct 2018 16:41:21 +0200 Subject: [PATCH 13/17] Fix tests --- .../elasticsearch/xpack/sql/planner/QueryTranslatorTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java index adc547536659e..00952555ebac6 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java @@ -193,7 +193,7 @@ public void testTranslateInExpression_HavingClause_Painless() { QueryTranslation translation = QueryTranslator.toQuery(condition, false); assertTrue(translation.query instanceof ScriptQuery); ScriptQuery sq = (ScriptQuery) translation.query; - assertEquals("params.a0==10 || params.a0==20", sq.script().toString()); + assertEquals("InternalSqlScriptUtils.nullSafeFilter(params.a0==10 || params.a0==20)", sq.script().toString()); assertThat(sq.script().params().toString(), startsWith("[{a=MAX(int){a->")); } } From a73615ea3442ca154f2e209fc0de378a6bfbb7ac Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Sat, 20 Oct 2018 01:55:48 +0200 Subject: [PATCH 14/17] Address comments, remove duplicates from IN list --- .../xpack/sql/expression/Expressions.java | 9 +++ .../xpack/sql/expression/predicate/In.java | 15 ++-- .../operator/comparison/Comparisons.java | 14 ++-- .../xpack/sql/planner/QueryTranslator.java | 2 +- .../xpack/sql/querydsl/query/TermsQuery.java | 5 +- .../xpack/sql/optimizer/OptimizerTests.java | 80 +++++++++++-------- .../sql/planner/QueryTranslatorTests.java | 4 +- 7 files changed, 76 insertions(+), 53 deletions(-) diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/Expressions.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/Expressions.java index dfaef60abd558..1d7bc2ee831c9 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/Expressions.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/Expressions.java @@ -71,6 +71,15 @@ public static boolean nullable(List exps) { return true; } + public static boolean foldable(List exps) { + for (Expression exp : exps) { + if (!exp.foldable()) { + return false; + } + } + return true; + } + public static AttributeSet references(List exps) { if (exps.isEmpty()) { return AttributeSet.EMPTY; diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java index ae0184ef0616e..a820833d1a013 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/In.java @@ -23,6 +23,7 @@ import org.elasticsearch.xpack.sql.util.CollectionUtils; import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; import java.util.Objects; @@ -41,12 +42,12 @@ public class In extends NamedExpression implements ScriptWeaver { public In(Location location, Expression value, List list) { super(location, null, CollectionUtils.combine(list, value), null); this.value = value; - this.list = list; + this.list = list.stream().distinct().collect(Collectors.toList()); } @Override protected NodeInfo info() { - return NodeInfo.create(this, In::new, value(), list()); + return NodeInfo.create(this, In::new, value, list); } @Override @@ -77,7 +78,7 @@ public boolean nullable() { @Override public boolean foldable() { - return children().stream().allMatch(Expression::foldable); + return Expressions.foldable(children()); } @Override @@ -115,17 +116,17 @@ public ScriptTemplate asScript() { ScriptTemplate leftScript = asScript(value); List rightParams = new ArrayList<>(); String scriptPrefix = leftScript + "=="; - for (Expression e : list) { - Object valueFromList = e.fold(); + LinkedHashSet values = list.stream().map(Expression::fold).collect(Collectors.toCollection(LinkedHashSet::new)); + for (Object valueFromList : values) { if (valueFromList instanceof Expression) { ScriptTemplate rightScript = asScript((Expression) valueFromList); sj.add(scriptPrefix + rightScript.template()); rightParams.add(rightScript.params()); } else { if (valueFromList instanceof String) { - sj.add(scriptPrefix + '"' + e + '"'); + sj.add(scriptPrefix + '"' + valueFromList + '"'); } else { - sj.add(scriptPrefix + e.toString()); + sj.add(scriptPrefix + valueFromList.toString()); } } } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/Comparisons.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/Comparisons.java index 0ab36f45fa7d0..79d3f2b318b59 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/Comparisons.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/Comparisons.java @@ -16,27 +16,27 @@ private Comparisons() {} public static Boolean eq(Object l, Object r) { Integer i = compare(l, r); - return i == null ? null : i == 0; + return i == null ? null : i.intValue() == 0; } static Boolean lt(Object l, Object r) { Integer i = compare(l, r); - return i == null ? null : i < 0; + return i == null ? null : i.intValue() < 0; } static Boolean lte(Object l, Object r) { Integer i = compare(l, r); - return i == null ? null : i <= 0; + return i == null ? null : i.intValue() <= 0; } static Boolean gt(Object l, Object r) { Integer i = compare(l, r); - return i == null ? null : i > 0; + return i == null ? null : i.intValue() > 0; } static Boolean gte(Object l, Object r) { Integer i = compare(l, r); - return i == null ? null : i >= 0; + return i == null ? null : i.intValue() >= 0; } static Boolean in(Object l, Set r) { @@ -57,7 +57,7 @@ static Integer compare(Object l, Object r) { if (l instanceof Comparable && r instanceof Comparable) { try { - return ((Comparable) l).compareTo(r); + return Integer.valueOf(((Comparable) l).compareTo(r)); } catch (ClassCastException cce) { // when types are not compatible, cce is thrown // fall back to null @@ -79,6 +79,6 @@ private static Integer compare(Number l, Number r) { return Long.compare(l.longValue(), r.longValue()); } - return Integer.compare(l.intValue(), r.intValue()); + return Integer.valueOf(Integer.compare(l.intValue(), r.intValue())); } } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java index adad5cec03cc7..453660f07da8a 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/planner/QueryTranslator.java @@ -150,7 +150,7 @@ static class QueryTranslation { } static QueryTranslation toQuery(Expression e, boolean onAggs) { - QueryTranslation translation; + QueryTranslation translation = null; for (ExpressionTranslator translator : QUERY_TRANSLATORS) { translation = translator.translate(e, onAggs); if (translation != null) { diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java index fb98353c750e5..0970e37c81180 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java @@ -9,6 +9,7 @@ import org.elasticsearch.xpack.sql.expression.Expression; import org.elasticsearch.xpack.sql.tree.Location; +import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -18,12 +19,12 @@ public class TermsQuery extends LeafQuery { private final String term; - private final List values; + private final LinkedHashSet values; public TermsQuery(Location location, String term, List values) { super(location); this.term = term; - this.values = values.stream().map(Expression::fold).collect(Collectors.toList()); + this.values = values.stream().map(Expression::fold).collect(Collectors.toCollection(LinkedHashSet::new)); } @Override diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/optimizer/OptimizerTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/optimizer/OptimizerTests.java index 608be8ab86f49..149b0cb34c073 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/optimizer/OptimizerTests.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/optimizer/OptimizerTests.java @@ -30,6 +30,7 @@ import org.elasticsearch.xpack.sql.expression.function.scalar.math.E; import org.elasticsearch.xpack.sql.expression.function.scalar.math.Floor; import org.elasticsearch.xpack.sql.expression.predicate.BinaryOperator; +import org.elasticsearch.xpack.sql.expression.predicate.In; import org.elasticsearch.xpack.sql.expression.predicate.IsNotNull; import org.elasticsearch.xpack.sql.expression.predicate.Range; import org.elasticsearch.xpack.sql.expression.predicate.logical.And; @@ -147,6 +148,11 @@ private static Literal L(Object value) { return Literal.of(EMPTY, value); } + private static FieldAttribute getFieldAttribute() { + return new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + } + + public void testPruneSubqueryAliases() { ShowTables s = new ShowTables(EMPTY, null, null); SubQueryAlias plan = new SubQueryAlias(EMPTY, s, "show"); @@ -298,6 +304,13 @@ public void testConstantFoldingDatetime() { new WeekOfYear(EMPTY, new Literal(EMPTY, null, DataType.NULL), UTC))); } + public void testConstantFoldingIn() { + In in = new In(EMPTY, ONE, + Arrays.asList(ONE, TWO, ONE, THREE, new Sub(EMPTY, THREE, ONE), ONE, FOUR, new Abs(EMPTY, new Sub(EMPTY, TWO, FIVE)))); + Literal result= (Literal) new ConstantFolding().rule(in); + assertEquals(true, result.value()); + } + public void testArithmeticFolding() { assertEquals(10, foldOperator(new Add(EMPTY, L(7), THREE))); assertEquals(4, foldOperator(new Sub(EMPTY, L(7), THREE))); @@ -389,7 +402,7 @@ public void testBoolCommonFactorExtraction() { // 6 < a <= 5 -> FALSE public void testFoldExcludingRangeToFalse() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r = new Range(EMPTY, fa, SIX, false, FIVE, true); assertTrue(r.foldable()); @@ -398,7 +411,7 @@ public void testFoldExcludingRangeToFalse() { // 6 < a <= 5.5 -> FALSE public void testFoldExcludingRangeWithDifferentTypesToFalse() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r = new Range(EMPTY, fa, SIX, false, L(5.5d), true); assertTrue(r.foldable()); @@ -408,7 +421,7 @@ public void testFoldExcludingRangeWithDifferentTypesToFalse() { // Conjunction public void testCombineBinaryComparisonsNotComparable() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); LessThanOrEqual lte = new LessThanOrEqual(EMPTY, fa, SIX); LessThan lt = new LessThan(EMPTY, fa, Literal.FALSE); @@ -420,7 +433,7 @@ public void testCombineBinaryComparisonsNotComparable() { // a <= 6 AND a < 5 -> a < 5 public void testCombineBinaryComparisonsUpper() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); LessThanOrEqual lte = new LessThanOrEqual(EMPTY, fa, SIX); LessThan lt = new LessThan(EMPTY, fa, FIVE); @@ -434,7 +447,7 @@ public void testCombineBinaryComparisonsUpper() { // 6 <= a AND 5 < a -> 6 <= a public void testCombineBinaryComparisonsLower() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); GreaterThanOrEqual gte = new GreaterThanOrEqual(EMPTY, fa, SIX); GreaterThan gt = new GreaterThan(EMPTY, fa, FIVE); @@ -448,7 +461,7 @@ public void testCombineBinaryComparisonsLower() { // 5 <= a AND 5 < a -> 5 < a public void testCombineBinaryComparisonsInclude() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); GreaterThanOrEqual gte = new GreaterThanOrEqual(EMPTY, fa, FIVE); GreaterThan gt = new GreaterThan(EMPTY, fa, FIVE); @@ -462,7 +475,7 @@ public void testCombineBinaryComparisonsInclude() { // 3 <= a AND 4 < a AND a <= 7 AND a < 6 -> 4 < a < 6 public void testCombineMultipleBinaryComparisons() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); GreaterThanOrEqual gte = new GreaterThanOrEqual(EMPTY, fa, THREE); GreaterThan gt = new GreaterThan(EMPTY, fa, FOUR); LessThanOrEqual lte = new LessThanOrEqual(EMPTY, fa, L(7)); @@ -481,7 +494,7 @@ public void testCombineMultipleBinaryComparisons() { // 3 <= a AND TRUE AND 4 < a AND a != 5 AND a <= 7 -> 4 < a <= 7 AND a != 5 AND TRUE public void testCombineMixedMultipleBinaryComparisons() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); GreaterThanOrEqual gte = new GreaterThanOrEqual(EMPTY, fa, THREE); GreaterThan gt = new GreaterThan(EMPTY, fa, FOUR); LessThanOrEqual lte = new LessThanOrEqual(EMPTY, fa, L(7)); @@ -503,7 +516,7 @@ public void testCombineMixedMultipleBinaryComparisons() { // 1 <= a AND a < 5 -> 1 <= a < 5 public void testCombineComparisonsIntoRange() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); GreaterThanOrEqual gte = new GreaterThanOrEqual(EMPTY, fa, ONE); LessThan lt = new LessThan(EMPTY, fa, FIVE); @@ -520,7 +533,7 @@ public void testCombineComparisonsIntoRange() { // a != NULL AND a > 1 AND a < 5 AND a == 10 -> (a != NULL AND a == 10) AND 1 <= a < 5 public void testCombineUnbalancedComparisonsMixedWithEqualsIntoRange() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); IsNotNull isn = new IsNotNull(EMPTY, fa); GreaterThanOrEqual gte = new GreaterThanOrEqual(EMPTY, fa, ONE); @@ -544,7 +557,7 @@ public void testCombineUnbalancedComparisonsMixedWithEqualsIntoRange() { // (2 < a < 3) AND (1 < a < 4) -> (2 < a < 3) public void testCombineBinaryComparisonsConjunctionOfIncludedRange() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r1 = new Range(EMPTY, fa, TWO, false, THREE, false); Range r2 = new Range(EMPTY, fa, ONE, false, FOUR, false); @@ -558,7 +571,7 @@ public void testCombineBinaryComparisonsConjunctionOfIncludedRange() { // (2 < a < 3) AND a < 2 -> 2 < a < 2 public void testCombineBinaryComparisonsConjunctionOfNonOverlappingBoundaries() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r1 = new Range(EMPTY, fa, TWO, false, THREE, false); Range r2 = new Range(EMPTY, fa, ONE, false, TWO, false); @@ -578,7 +591,7 @@ public void testCombineBinaryComparisonsConjunctionOfNonOverlappingBoundaries() // (2 < a < 3) AND (2 < a <= 3) -> 2 < a < 3 public void testCombineBinaryComparisonsConjunctionOfUpperEqualsOverlappingBoundaries() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r1 = new Range(EMPTY, fa, TWO, false, THREE, false); Range r2 = new Range(EMPTY, fa, TWO, false, THREE, true); @@ -592,7 +605,7 @@ public void testCombineBinaryComparisonsConjunctionOfUpperEqualsOverlappingBound // (2 < a < 3) AND (1 < a < 3) -> 2 < a < 3 public void testCombineBinaryComparisonsConjunctionOverlappingUpperBoundary() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r2 = new Range(EMPTY, fa, TWO, false, THREE, false); Range r1 = new Range(EMPTY, fa, ONE, false, THREE, false); @@ -606,7 +619,7 @@ public void testCombineBinaryComparisonsConjunctionOverlappingUpperBoundary() { // (2 < a <= 3) AND (1 < a < 3) -> 2 < a < 3 public void testCombineBinaryComparisonsConjunctionWithDifferentUpperLimitInclusion() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r1 = new Range(EMPTY, fa, ONE, false, THREE, false); Range r2 = new Range(EMPTY, fa, TWO, false, THREE, true); @@ -625,7 +638,7 @@ public void testCombineBinaryComparisonsConjunctionWithDifferentUpperLimitInclus // (0 < a <= 1) AND (0 <= a < 2) -> 0 < a <= 1 public void testRangesOverlappingConjunctionNoLowerBoundary() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r1 = new Range(EMPTY, fa, L(0), false, ONE, true); Range r2 = new Range(EMPTY, fa, L(0), true, TWO, false); @@ -640,7 +653,7 @@ public void testRangesOverlappingConjunctionNoLowerBoundary() { // Disjunction public void testCombineBinaryComparisonsDisjunctionNotComparable() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); GreaterThan gt1 = new GreaterThan(EMPTY, fa, ONE); GreaterThan gt2 = new GreaterThan(EMPTY, fa, Literal.FALSE); @@ -655,7 +668,7 @@ public void testCombineBinaryComparisonsDisjunctionNotComparable() { // 2 < a OR 1 < a OR 3 < a -> 1 < a public void testCombineBinaryComparisonsDisjunctionLowerBound() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); GreaterThan gt1 = new GreaterThan(EMPTY, fa, ONE); GreaterThan gt2 = new GreaterThan(EMPTY, fa, TWO); @@ -673,7 +686,7 @@ public void testCombineBinaryComparisonsDisjunctionLowerBound() { // 2 < a OR 1 < a OR 3 <= a -> 1 < a public void testCombineBinaryComparisonsDisjunctionIncludeLowerBounds() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); GreaterThan gt1 = new GreaterThan(EMPTY, fa, ONE); GreaterThan gt2 = new GreaterThan(EMPTY, fa, TWO); @@ -691,7 +704,7 @@ public void testCombineBinaryComparisonsDisjunctionIncludeLowerBounds() { // a < 1 OR a < 2 OR a < 3 -> a < 3 public void testCombineBinaryComparisonsDisjunctionUpperBound() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); LessThan lt1 = new LessThan(EMPTY, fa, ONE); LessThan lt2 = new LessThan(EMPTY, fa, TWO); @@ -709,7 +722,7 @@ public void testCombineBinaryComparisonsDisjunctionUpperBound() { // a < 2 OR a <= 2 OR a < 1 -> a <= 2 public void testCombineBinaryComparisonsDisjunctionIncludeUpperBounds() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); LessThan lt1 = new LessThan(EMPTY, fa, ONE); LessThan lt2 = new LessThan(EMPTY, fa, TWO); @@ -727,7 +740,7 @@ public void testCombineBinaryComparisonsDisjunctionIncludeUpperBounds() { // a < 2 OR 3 < a OR a < 1 OR 4 < a -> a < 2 OR 3 < a public void testCombineBinaryComparisonsDisjunctionOfLowerAndUpperBounds() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); LessThan lt1 = new LessThan(EMPTY, fa, ONE); LessThan lt2 = new LessThan(EMPTY, fa, TWO); @@ -753,7 +766,7 @@ public void testCombineBinaryComparisonsDisjunctionOfLowerAndUpperBounds() { // (2 < a < 3) OR (1 < a < 4) -> (1 < a < 4) public void testCombineBinaryComparisonsDisjunctionOfIncludedRangeNotComparable() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r1 = new Range(EMPTY, fa, TWO, false, THREE, false); Range r2 = new Range(EMPTY, fa, ONE, false, Literal.FALSE, false); @@ -765,10 +778,9 @@ public void testCombineBinaryComparisonsDisjunctionOfIncludedRangeNotComparable( assertEquals(or, exp); } - // (2 < a < 3) OR (1 < a < 4) -> (1 < a < 4) public void testCombineBinaryComparisonsDisjunctionOfIncludedRange() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r1 = new Range(EMPTY, fa, TWO, false, THREE, false); @@ -789,7 +801,7 @@ public void testCombineBinaryComparisonsDisjunctionOfIncludedRange() { // (2 < a < 3) OR (1 < a < 2) -> same public void testCombineBinaryComparisonsDisjunctionOfNonOverlappingBoundaries() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r1 = new Range(EMPTY, fa, TWO, false, THREE, false); Range r2 = new Range(EMPTY, fa, ONE, false, TWO, false); @@ -803,7 +815,7 @@ public void testCombineBinaryComparisonsDisjunctionOfNonOverlappingBoundaries() // (2 < a < 3) OR (2 < a <= 3) -> 2 < a <= 3 public void testCombineBinaryComparisonsDisjunctionOfUpperEqualsOverlappingBoundaries() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r1 = new Range(EMPTY, fa, TWO, false, THREE, false); Range r2 = new Range(EMPTY, fa, TWO, false, THREE, true); @@ -817,7 +829,7 @@ public void testCombineBinaryComparisonsDisjunctionOfUpperEqualsOverlappingBound // (2 < a < 3) OR (1 < a < 3) -> 1 < a < 3 public void testCombineBinaryComparisonsOverlappingUpperBoundary() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r2 = new Range(EMPTY, fa, TWO, false, THREE, false); Range r1 = new Range(EMPTY, fa, ONE, false, THREE, false); @@ -831,7 +843,7 @@ public void testCombineBinaryComparisonsOverlappingUpperBoundary() { // (2 < a <= 3) OR (1 < a < 3) -> same (the <= prevents the ranges from being combined) public void testCombineBinaryComparisonsWithDifferentUpperLimitInclusion() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r1 = new Range(EMPTY, fa, ONE, false, THREE, false); Range r2 = new Range(EMPTY, fa, TWO, false, THREE, true); @@ -845,7 +857,7 @@ public void testCombineBinaryComparisonsWithDifferentUpperLimitInclusion() { // (0 < a <= 1) OR (0 < a < 2) -> 0 < a < 2 public void testRangesOverlappingNoLowerBoundary() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Range r2 = new Range(EMPTY, fa, L(0), false, TWO, false); Range r1 = new Range(EMPTY, fa, L(0), false, ONE, true); @@ -861,7 +873,7 @@ public void testRangesOverlappingNoLowerBoundary() { // a == 1 AND a == 2 -> FALSE public void testDualEqualsConjunction() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Equals eq1 = new Equals(EMPTY, fa, ONE); Equals eq2 = new Equals(EMPTY, fa, TWO); @@ -872,7 +884,7 @@ public void testDualEqualsConjunction() { // 1 <= a < 10 AND a == 1 -> a == 1 public void testEliminateRangeByEqualsInInterval() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Equals eq1 = new Equals(EMPTY, fa, ONE); Range r = new Range(EMPTY, fa, ONE, true, L(10), false); @@ -883,7 +895,7 @@ public void testEliminateRangeByEqualsInInterval() { // 1 < a < 10 AND a == 10 -> FALSE public void testEliminateRangeByEqualsOutsideInterval() { - FieldAttribute fa = new FieldAttribute(EMPTY, "a", new EsField("af", DataType.INTEGER, emptyMap(), true)); + FieldAttribute fa = getFieldAttribute(); Equals eq1 = new Equals(EMPTY, fa, L(10)); Range r = new Range(EMPTY, fa, ONE, false, L(10), false); @@ -891,4 +903,4 @@ public void testEliminateRangeByEqualsOutsideInterval() { Expression exp = rule.rule(new And(EMPTY, eq1, r)); assertEquals(Literal.FALSE, rule.rule(exp)); } -} \ No newline at end of file +} diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java index 00952555ebac6..8d5db634ff073 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/planner/QueryTranslatorTests.java @@ -161,7 +161,7 @@ public void testLikeConstructsNotSupported() { } public void testTranslateInExpression_WhereClause() throws IOException { - LogicalPlan p = plan("SELECT * FROM test WHERE keyword IN ('foo', 'bar', 'lala')"); + LogicalPlan p = plan("SELECT * FROM test WHERE keyword IN ('foo', 'bar', 'lala', 'foo', concat('la', 'la'))"); assertTrue(p instanceof Project); assertTrue(p.children().get(0) instanceof Filter); Expression condition = ((Filter) p.children().get(0)).condition(); @@ -185,7 +185,7 @@ public void testTranslateInExpressionInvalidValues_WhereClause() { } public void testTranslateInExpression_HavingClause_Painless() { - LogicalPlan p = plan("SELECT keyword, max(int) FROM test GROUP BY keyword HAVING max(int) in (10, 20)"); + LogicalPlan p = plan("SELECT keyword, max(int) FROM test GROUP BY keyword HAVING max(int) in (10, 20, 30 - 10)"); assertTrue(p instanceof Project); assertTrue(p.children().get(0) instanceof Filter); Expression condition = ((Filter) p.children().get(0)).condition(); From 6b4ddf1467a4bb11682cede191d838e9cf2c1a49 Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Sun, 21 Oct 2018 17:53:00 +0200 Subject: [PATCH 15/17] Address comments --- .../elasticsearch/xpack/sql/querydsl/query/TermsQuery.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java index 0970e37c81180..412df4e8ca682 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/querydsl/query/TermsQuery.java @@ -7,12 +7,12 @@ import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.xpack.sql.expression.Expression; +import org.elasticsearch.xpack.sql.expression.Foldables; import org.elasticsearch.xpack.sql.tree.Location; import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; -import java.util.stream.Collectors; import static org.elasticsearch.index.query.QueryBuilders.termsQuery; @@ -24,7 +24,7 @@ public class TermsQuery extends LeafQuery { public TermsQuery(Location location, String term, List values) { super(location); this.term = term; - this.values = values.stream().map(Expression::fold).collect(Collectors.toCollection(LinkedHashSet::new)); + this.values = new LinkedHashSet<>(Foldables.valuesOf(values, values.get(0).dataType())); } @Override From d1e1018f2f5a2959c45f64cce5656f162875ceec Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Mon, 22 Oct 2018 11:36:32 +0200 Subject: [PATCH 16/17] Added test --- .../xpack/sql/optimizer/OptimizerTests.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/optimizer/OptimizerTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/optimizer/OptimizerTests.java index 149b0cb34c073..acd0378ee010f 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/optimizer/OptimizerTests.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/optimizer/OptimizerTests.java @@ -10,6 +10,7 @@ import org.elasticsearch.xpack.sql.expression.Expression; import org.elasticsearch.xpack.sql.expression.Expressions; import org.elasticsearch.xpack.sql.expression.FieldAttribute; +import org.elasticsearch.xpack.sql.expression.Foldables; import org.elasticsearch.xpack.sql.expression.Literal; import org.elasticsearch.xpack.sql.expression.NamedExpression; import org.elasticsearch.xpack.sql.expression.Order; @@ -82,6 +83,7 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.singletonList; import static org.elasticsearch.xpack.sql.tree.Location.EMPTY; +import static org.hamcrest.Matchers.contains; public class OptimizerTests extends ESTestCase { @@ -311,6 +313,16 @@ public void testConstantFoldingIn() { assertEquals(true, result.value()); } + public void testConstantFoldingIn_LeftValueNotFoldable() { + Project p = new Project(EMPTY, FROM(), Collections.singletonList( + new In(EMPTY, getFieldAttribute(), + Arrays.asList(ONE, TWO, ONE, THREE, new Sub(EMPTY, THREE, ONE), ONE, FOUR, new Abs(EMPTY, new Sub(EMPTY, TWO, FIVE)))))); + p = (Project) new ConstantFolding().apply(p); + assertEquals(1, p.projections().size()); + In in = (In) p.projections().get(0); + assertThat(Foldables.valuesOf(in.list(), DataType.INTEGER), contains(1 ,2 ,3 ,4)); + } + public void testArithmeticFolding() { assertEquals(10, foldOperator(new Add(EMPTY, L(7), THREE))); assertEquals(4, foldOperator(new Sub(EMPTY, L(7), THREE))); From 9fc60b233ef7c5339d0f42cb0ee91c545eda970a Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Mon, 22 Oct 2018 22:08:43 +0200 Subject: [PATCH 17/17] add more tests --- .../operator/comparison/InProcessor.java | 25 +++++++-- .../predicate/InProcessorTests.java | 53 +++++++++++++++++++ .../qa/sql/src/main/resources/select.csv-spec | 2 +- 3 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/expression/predicate/InProcessorTests.java diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java index 16ef71672b79d..5ebf8870965b5 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/operator/comparison/InProcessor.java @@ -11,18 +11,19 @@ import java.io.IOException; import java.util.List; +import java.util.Objects; -class InProcessor implements Processor { +public class InProcessor implements Processor { public static final String NAME = "in"; private final List processsors; - InProcessor(List processors) { + public InProcessor(List processors) { this.processsors = processors; } - InProcessor(StreamInput in) throws IOException { + public InProcessor(StreamInput in) throws IOException { processsors = in.readNamedWriteableList(Processor.class); } @@ -38,8 +39,9 @@ public final void writeTo(StreamOutput out) throws IOException { @Override public Object process(Object input) { - Object leftValue = processsors.get(0).process(input); - for (int i = 1; i < processsors.size(); i++) { + Object leftValue = processsors.get(processsors.size() - 1).process(input); + + for (int i = 0; i < processsors.size() - 1; i++) { Boolean compResult = Comparisons.eq(leftValue, processsors.get(i).process(input)); if (compResult != null && compResult) { return true; @@ -47,4 +49,17 @@ public Object process(Object input) { } return false; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + InProcessor that = (InProcessor) o; + return Objects.equals(processsors, that.processsors); + } + + @Override + public int hashCode() { + return Objects.hash(processsors); + } } diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/expression/predicate/InProcessorTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/expression/predicate/InProcessorTests.java new file mode 100644 index 0000000000000..3e71ac90f8127 --- /dev/null +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/expression/predicate/InProcessorTests.java @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.xpack.sql.expression.predicate; + +import org.elasticsearch.common.io.stream.NamedWriteableRegistry; +import org.elasticsearch.common.io.stream.Writeable.Reader; +import org.elasticsearch.test.AbstractWireSerializingTestCase; +import org.elasticsearch.xpack.sql.expression.Literal; +import org.elasticsearch.xpack.sql.expression.function.scalar.Processors; +import org.elasticsearch.xpack.sql.expression.gen.processor.ConstantProcessor; +import org.elasticsearch.xpack.sql.expression.predicate.operator.comparison.InProcessor; + +import java.util.Arrays; + +import static org.elasticsearch.xpack.sql.tree.Location.EMPTY; + +public class InProcessorTests extends AbstractWireSerializingTestCase { + + private static final Literal ONE = L(1); + private static final Literal TWO = L(2); + private static final Literal THREE = L(3); + + public static InProcessor randomProcessor() { + return new InProcessor(Arrays.asList(new ConstantProcessor(randomLong()), new ConstantProcessor(randomLong()))); + } + + @Override + protected InProcessor createTestInstance() { + return randomProcessor(); + } + + @Override + protected Reader instanceReader() { + return InProcessor::new; + } + + @Override + protected NamedWriteableRegistry getNamedWriteableRegistry() { + return new NamedWriteableRegistry(Processors.getNamedWriteables()); + } + + public void testEq() { + assertEquals(true, new In(EMPTY, TWO, Arrays.asList(ONE, TWO, THREE)).makePipe().asProcessor().process(null)); + assertEquals(false, new In(EMPTY, THREE, Arrays.asList(ONE, TWO)).makePipe().asProcessor().process(null)); + } + + private static Literal L(Object value) { + return Literal.of(EMPTY, value); + } +} diff --git a/x-pack/qa/sql/src/main/resources/select.csv-spec b/x-pack/qa/sql/src/main/resources/select.csv-spec index 5181f7f699b15..b3888abd47bf3 100644 --- a/x-pack/qa/sql/src/main/resources/select.csv-spec +++ b/x-pack/qa/sql/src/main/resources/select.csv-spec @@ -26,7 +26,7 @@ false |true // -// SELECT with IN +// SELECT with IN and table columns // inWithTableColumn SELECT emp_no IN (10000, 10001, 10002) FROM test_emp ORDER BY 1;