SQL: Break long lines in execution package (elastic/x-pack-elasticsearch#3453)
Fixes lines longer than 140 characters to be shorter. Original commit: elastic/x-pack-elasticsearch@517ed6cde9
This commit is contained in:
parent
f7159ce56f
commit
c2527ed0f6
|
@ -10,9 +10,6 @@
|
||||||
|
|
||||||
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]analysis[/\\]analyzer[/\\]Analyzer.java" checks="LineLength" />
|
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]analysis[/\\]analyzer[/\\]Analyzer.java" checks="LineLength" />
|
||||||
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]analysis[/\\]analyzer[/\\]Verifier.java" checks="LineLength" />
|
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]analysis[/\\]analyzer[/\\]Verifier.java" checks="LineLength" />
|
||||||
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]execution[/\\]search[/\\]AggValues.java" checks="LineLength" />
|
|
||||||
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]execution[/\\]search[/\\]Scroller.java" checks="LineLength" />
|
|
||||||
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]execution[/\\]search[/\\]SourceGenerator.java" checks="LineLength" />
|
|
||||||
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]expression[/\\]Attribute.java" checks="LineLength" />
|
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]expression[/\\]Attribute.java" checks="LineLength" />
|
||||||
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]expression[/\\]ExpressionIdGenerator.java" checks="LineLength" />
|
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]expression[/\\]ExpressionIdGenerator.java" checks="LineLength" />
|
||||||
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]expression[/\\]FieldAttribute.java" checks="LineLength" />
|
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]expression[/\\]FieldAttribute.java" checks="LineLength" />
|
||||||
|
|
|
@ -9,19 +9,26 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aggregations are returned by Elasticsearch in a tree structure where each nested level can have a different size.
|
* Aggregations are returned by Elasticsearch in a tree structure where each
|
||||||
* For example a group by a, b, c results in 3-level nested array where each level contains all the relevant values
|
* nested level can have a different size. For example a group by a, b, c
|
||||||
* for its parent entry.
|
* results in 3-level nested array where each level contains all the relevant
|
||||||
|
* values for its parent entry.
|
||||||
|
* <p>
|
||||||
* Assuming there's a total of 2 A's, 3 B's and 5 C's, the values will be
|
* Assuming there's a total of 2 A's, 3 B's and 5 C's, the values will be
|
||||||
* A-agg level = { A1, A2 }
|
* <ul>
|
||||||
* B-agg level = { { A1B1, A1B2, A1B3 }, { A2B1, A2B2, A2B3 }
|
* <li>A-agg level = { A1, A2 }
|
||||||
* C-agg level = { { { A1B1C1, A1B1C2 ..}, { A1B2C1, etc... } } } and so on
|
* <li>B-agg level = { { A1B1, A1B2, A1B3 }, { A2B1, A2B2, A2B3 }
|
||||||
*
|
* <li>C-agg level = { { { A1B1C1, A1B1C2 ..}, { A1B2C1, etc... } } } and so on
|
||||||
* Further more the columns are added in the order in which they are requested (0, 1, 2) eliminating the need for keys as these are implicit (their position in the list).
|
* </ul>
|
||||||
*
|
* <p>
|
||||||
* To help with the iteration, there are two dedicated counters :
|
* Further more the columns are added in the order in which they are requested
|
||||||
* one that carries (increments) the counter for each level (indicated by the position inside the array) once the children reach their max
|
* (0, 1, 2) eliminating the need for keys as these are implicit (their position
|
||||||
* a flat cursor to indicate the row
|
* in the list).
|
||||||
|
* <p>
|
||||||
|
* To help with the iteration, there are two dedicated counters:
|
||||||
|
* one that carries (increments) the counter for each level (indicated by the
|
||||||
|
* position inside the array) once the children reach their max a flat cursor
|
||||||
|
* to indicate the row.
|
||||||
*/
|
*/
|
||||||
class AggValues {
|
class AggValues {
|
||||||
private int row = 0;
|
private int row = 0;
|
||||||
|
|
|
@ -99,7 +99,8 @@ public class Scroller {
|
||||||
|
|
||||||
private final QueryContainer query;
|
private final QueryContainer query;
|
||||||
|
|
||||||
AggsScrollActionListener(ActionListener<SchemaRowSet> listener, Client client, TimeValue keepAlive, Schema schema, QueryContainer query) {
|
AggsScrollActionListener(ActionListener<SchemaRowSet> listener, Client client, TimeValue keepAlive,
|
||||||
|
Schema schema, QueryContainer query) {
|
||||||
super(listener, client, keepAlive, schema);
|
super(listener, client, keepAlive, schema);
|
||||||
this.query = query;
|
this.query = query;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +281,8 @@ public class Scroller {
|
||||||
|
|
||||||
if (ref instanceof ComputedRef) {
|
if (ref instanceof ComputedRef) {
|
||||||
ProcessorDefinition proc = ((ComputedRef) ref).processor();
|
ProcessorDefinition proc = ((ComputedRef) ref).processor();
|
||||||
proc = proc.transformDown(l -> new HitExtractorInput(l.expression(), createExtractor(l.context())), ReferenceInput.class);
|
proc = proc.transformDown(l -> new HitExtractorInput(l.expression(),
|
||||||
|
createExtractor(l.context())), ReferenceInput.class);
|
||||||
return new ComputingHitExtractor(proc.asProcessor());
|
return new ComputingHitExtractor(proc.asProcessor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.elasticsearch.xpack.sql.execution.search;
|
||||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||||
import org.elasticsearch.index.query.ConstantScoreQueryBuilder;
|
import org.elasticsearch.index.query.ConstantScoreQueryBuilder;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
import org.elasticsearch.script.Script;
|
|
||||||
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
import org.elasticsearch.search.aggregations.AggregationBuilder;
|
||||||
import org.elasticsearch.search.aggregations.PipelineAggregationBuilder;
|
import org.elasticsearch.search.aggregations.PipelineAggregationBuilder;
|
||||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||||
|
@ -19,35 +18,20 @@ import org.elasticsearch.search.sort.NestedSortBuilder;
|
||||||
import org.elasticsearch.search.sort.ScriptSortBuilder.ScriptSortType;
|
import org.elasticsearch.search.sort.ScriptSortBuilder.ScriptSortType;
|
||||||
import org.elasticsearch.search.sort.SortBuilder;
|
import org.elasticsearch.search.sort.SortBuilder;
|
||||||
import org.elasticsearch.search.sort.SortOrder;
|
import org.elasticsearch.search.sort.SortOrder;
|
||||||
import org.elasticsearch.xpack.sql.SqlIllegalArgumentException;
|
|
||||||
import org.elasticsearch.xpack.sql.expression.Attribute;
|
import org.elasticsearch.xpack.sql.expression.Attribute;
|
||||||
import org.elasticsearch.xpack.sql.expression.FieldAttribute;
|
import org.elasticsearch.xpack.sql.expression.FieldAttribute;
|
||||||
import org.elasticsearch.xpack.sql.expression.function.scalar.processor.definition.ProcessorDefinition;
|
|
||||||
import org.elasticsearch.xpack.sql.expression.function.scalar.processor.definition.ReferenceInput;
|
|
||||||
import org.elasticsearch.xpack.sql.expression.function.scalar.processor.definition.ScoreProcessorDefinition;
|
|
||||||
import org.elasticsearch.xpack.sql.querydsl.agg.Aggs;
|
import org.elasticsearch.xpack.sql.querydsl.agg.Aggs;
|
||||||
import org.elasticsearch.xpack.sql.querydsl.agg.GroupByColumnAgg;
|
import org.elasticsearch.xpack.sql.querydsl.agg.GroupByColumnAgg;
|
||||||
import org.elasticsearch.xpack.sql.querydsl.agg.GroupingAgg;
|
import org.elasticsearch.xpack.sql.querydsl.agg.GroupingAgg;
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.AggRef;
|
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.AttributeSort;
|
import org.elasticsearch.xpack.sql.querydsl.container.AttributeSort;
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.ColumnReference;
|
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.ComputedRef;
|
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.QueryContainer;
|
import org.elasticsearch.xpack.sql.querydsl.container.QueryContainer;
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.ScoreSort;
|
import org.elasticsearch.xpack.sql.querydsl.container.ScoreSort;
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.ScriptFieldRef;
|
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.ScriptSort;
|
import org.elasticsearch.xpack.sql.querydsl.container.ScriptSort;
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.SearchHitFieldRef;
|
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.Sort;
|
import org.elasticsearch.xpack.sql.querydsl.container.Sort;
|
||||||
import org.elasticsearch.xpack.sql.querydsl.container.Sort.Direction;
|
import org.elasticsearch.xpack.sql.querydsl.container.Sort.Direction;
|
||||||
import org.elasticsearch.xpack.sql.querydsl.query.NestedQuery;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
import static org.elasticsearch.search.sort.SortBuilders.fieldSort;
|
import static org.elasticsearch.search.sort.SortBuilders.fieldSort;
|
||||||
|
@ -169,7 +153,8 @@ public abstract class SourceGenerator {
|
||||||
}
|
}
|
||||||
} else if (sortable instanceof ScriptSort) {
|
} else if (sortable instanceof ScriptSort) {
|
||||||
ScriptSort ss = (ScriptSort) sortable;
|
ScriptSort ss = (ScriptSort) sortable;
|
||||||
sortBuilder = scriptSort(ss.script().toPainless(), ss.script().outputType().isNumeric() ? ScriptSortType.NUMBER : ScriptSortType.STRING);
|
sortBuilder = scriptSort(ss.script().toPainless(),
|
||||||
|
ss.script().outputType().isNumeric() ? ScriptSortType.NUMBER : ScriptSortType.STRING);
|
||||||
} else if (sortable instanceof ScoreSort) {
|
} else if (sortable instanceof ScoreSort) {
|
||||||
sortBuilder = scoreSort();
|
sortBuilder = scoreSort();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue