Search in sources :

Example 6 with Lists2.mapTail

use of io.crate.common.collections.Lists2.mapTail in project crate by crate.

the class WhereClauseAnalyzer method resolvePartitions.

public static PartitionResult resolvePartitions(Symbol query, DocTableInfo tableInfo, CoordinatorTxnCtx coordinatorTxnCtx, NodeContext nodeCtx) {
    assert tableInfo.isPartitioned() : "table must be partitioned in order to resolve partitions";
    assert !tableInfo.partitions().isEmpty() : "table must have at least one partition";
    PartitionReferenceResolver partitionReferenceResolver = preparePartitionResolver(tableInfo.partitionedByColumns());
    EvaluatingNormalizer normalizer = new EvaluatingNormalizer(nodeCtx, RowGranularity.PARTITION, partitionReferenceResolver, null);
    Symbol normalized;
    Map<Symbol, List<Literal>> queryPartitionMap = new HashMap<>();
    for (PartitionName partitionName : tableInfo.partitions()) {
        for (PartitionExpression partitionExpression : partitionReferenceResolver.expressions()) {
            partitionExpression.setNextRow(partitionName);
        }
        normalized = normalizer.normalize(query, coordinatorTxnCtx);
        assert normalized != null : "normalizing a query must not return null";
        if (normalized.equals(query)) {
            // no partition columns inside the where clause
            return new PartitionResult(query, Collections.emptyList());
        }
        boolean canMatch = WhereClause.canMatch(normalized);
        if (canMatch) {
            List<Literal> partitions = queryPartitionMap.get(normalized);
            if (partitions == null) {
                partitions = new ArrayList<>();
                queryPartitionMap.put(normalized, partitions);
            }
            partitions.add(Literal.of(partitionName.asIndexName()));
        }
    }
    if (queryPartitionMap.size() == 1) {
        Map.Entry<Symbol, List<Literal>> entry = Iterables.getOnlyElement(queryPartitionMap.entrySet());
        return new PartitionResult(entry.getKey(), Lists2.map(entry.getValue(), literal -> nullOrString(literal.value())));
    } else if (queryPartitionMap.size() > 0) {
        PartitionResult partitionResult = tieBreakPartitionQueries(normalizer, queryPartitionMap, coordinatorTxnCtx);
        return partitionResult == null ? // the query will then be evaluated correctly within each partition to see whether it matches or not
        new PartitionResult(query, Lists2.map(tableInfo.partitions(), PartitionName::asIndexName)) : partitionResult;
    } else {
        return new PartitionResult(Literal.BOOLEAN_FALSE, Collections.emptyList());
    }
}
Also used : Tuple(io.crate.common.collections.Tuple) ScalarsAndRefsToTrue(io.crate.analyze.ScalarsAndRefsToTrue) HashMap(java.util.HashMap) EvaluatingNormalizer(io.crate.expression.eval.EvaluatingNormalizer) PartitionName(io.crate.metadata.PartitionName) ArrayList(java.util.ArrayList) Map(java.util.Map) StringUtils.nullOrString(io.crate.common.StringUtils.nullOrString) Nullable(javax.annotation.Nullable) DocTableInfo(io.crate.metadata.doc.DocTableInfo) NodeContext(io.crate.metadata.NodeContext) WhereClause(io.crate.analyze.WhereClause) PartitionReferenceResolver(io.crate.metadata.PartitionReferenceResolver) Reference(io.crate.metadata.Reference) Iterables(io.crate.common.collections.Iterables) Lists2(io.crate.common.collections.Lists2) List(java.util.List) RowGranularity(io.crate.metadata.RowGranularity) DocTableRelation(io.crate.analyze.relations.DocTableRelation) Literal(io.crate.expression.symbol.Literal) Symbol(io.crate.expression.symbol.Symbol) AbstractTableRelation(io.crate.analyze.relations.AbstractTableRelation) PartitionExpression(io.crate.expression.reference.partitioned.PartitionExpression) Collections(java.util.Collections) CoordinatorTxnCtx(io.crate.metadata.CoordinatorTxnCtx) EvaluatingNormalizer(io.crate.expression.eval.EvaluatingNormalizer) HashMap(java.util.HashMap) Symbol(io.crate.expression.symbol.Symbol) PartitionName(io.crate.metadata.PartitionName) PartitionExpression(io.crate.expression.reference.partitioned.PartitionExpression) Literal(io.crate.expression.symbol.Literal) ArrayList(java.util.ArrayList) List(java.util.List) PartitionReferenceResolver(io.crate.metadata.PartitionReferenceResolver) HashMap(java.util.HashMap) Map(java.util.Map)

Example 7 with Lists2.mapTail

use of io.crate.common.collections.Lists2.mapTail in project crate by crate.

the class CreateSnapshotAnalyzer method analyze.

public AnalyzedCreateSnapshot analyze(CreateSnapshot<Expression> createSnapshot, ParamTypeHints paramTypeHints, CoordinatorTxnCtx txnCtx) {
    String repositoryName = createSnapshot.name().getPrefix().map(name -> {
        validateRepository(name);
        return name.toString();
    }).orElseThrow(() -> new IllegalArgumentException("Snapshot must be specified by \"<repository_name>\".\"<snapshot_name>\""));
    String snapshotName = createSnapshot.name().getSuffix();
    Snapshot snapshot = new Snapshot(repositoryName, new SnapshotId(snapshotName, UUIDs.dirtyUUID().toString()));
    var exprCtx = new ExpressionAnalysisContext(txnCtx.sessionContext());
    var exprAnalyzerWithoutFields = new ExpressionAnalyzer(txnCtx, nodeCtx, paramTypeHints, FieldProvider.UNSUPPORTED, null);
    var exprAnalyzerWithFieldsAsString = new ExpressionAnalyzer(txnCtx, nodeCtx, paramTypeHints, FieldProvider.FIELDS_AS_LITERAL, null);
    List<Table<Symbol>> tables = Lists2.map(createSnapshot.tables(), (table) -> table.map(x -> exprAnalyzerWithFieldsAsString.convert(x, exprCtx)));
    GenericProperties<Symbol> properties = createSnapshot.properties().map(x -> exprAnalyzerWithoutFields.convert(x, exprCtx));
    return new AnalyzedCreateSnapshot(snapshot, tables, properties);
}
Also used : ExpressionAnalyzer(io.crate.analyze.expressions.ExpressionAnalyzer) NodeContext(io.crate.metadata.NodeContext) SnapshotId(org.elasticsearch.snapshots.SnapshotId) ExpressionAnalysisContext(io.crate.analyze.expressions.ExpressionAnalysisContext) RepositoryService(io.crate.execution.ddl.RepositoryService) FieldProvider(io.crate.analyze.relations.FieldProvider) CreateSnapshot(io.crate.sql.tree.CreateSnapshot) UUIDs(org.elasticsearch.common.UUIDs) Table(io.crate.sql.tree.Table) GenericProperties(io.crate.sql.tree.GenericProperties) Lists2(io.crate.common.collections.Lists2) List(java.util.List) Symbol(io.crate.expression.symbol.Symbol) Locale(java.util.Locale) QualifiedName(io.crate.sql.tree.QualifiedName) Snapshot(org.elasticsearch.snapshots.Snapshot) Expression(io.crate.sql.tree.Expression) CoordinatorTxnCtx(io.crate.metadata.CoordinatorTxnCtx) ExpressionAnalysisContext(io.crate.analyze.expressions.ExpressionAnalysisContext) Table(io.crate.sql.tree.Table) Symbol(io.crate.expression.symbol.Symbol) ExpressionAnalyzer(io.crate.analyze.expressions.ExpressionAnalyzer) CreateSnapshot(io.crate.sql.tree.CreateSnapshot) Snapshot(org.elasticsearch.snapshots.Snapshot) SnapshotId(org.elasticsearch.snapshots.SnapshotId)

Example 8 with Lists2.mapTail

use of io.crate.common.collections.Lists2.mapTail in project crate by crate.

the class DocIndexMetadataTest method testExtractColumnDefinitions.

@Test
public void testExtractColumnDefinitions() throws Exception {
    // @formatter:off
    XContentBuilder builder = XContentFactory.jsonBuilder().startObject().startObject("_meta").field("primary_keys", "integerIndexed").endObject().startObject("properties").startObject("integerIndexed").field("type", "integer").endObject().startObject("integerIndexedBWC").field("type", "integer").field("index", "not_analyzed").endObject().startObject("integerNotIndexed").field("type", "integer").field("index", "false").endObject().startObject("integerNotIndexedBWC").field("type", "integer").field("index", "no").endObject().startObject("stringNotIndexed").field("type", "string").field("index", "false").endObject().startObject("stringNotIndexedBWC").field("type", "string").field("index", "no").endObject().startObject("stringNotAnalyzed").field("type", "keyword").endObject().startObject("stringNotAnalyzedBWC").field("type", "string").field("index", "not_analyzed").endObject().startObject("stringAnalyzed").field("type", "text").field("analyzer", "standard").endObject().startObject("stringAnalyzedBWC").field("type", "string").field("index", "analyzed").field("analyzer", "standard").endObject().startObject("person").startObject("properties").startObject("first_name").field("type", "string").endObject().startObject("birthday").field("type", "date").endObject().endObject().endObject().endObject().endObject();
    // @formatter:on
    IndexMetadata metadata = getIndexMetadata("test1", builder);
    DocIndexMetadata md = newMeta(metadata, "test1");
    assertThat(md.columns().size(), is(11));
    assertThat(md.references().size(), is(23));
    Reference birthday = md.references().get(new ColumnIdent("person", "birthday"));
    assertThat(birthday.valueType(), is(DataTypes.TIMESTAMPZ));
    assertThat(birthday.indexType(), is(Reference.IndexType.PLAIN));
    assertThat(birthday.defaultExpression(), is(nullValue()));
    Reference integerIndexed = md.references().get(new ColumnIdent("integerIndexed"));
    assertThat(integerIndexed.indexType(), is(Reference.IndexType.PLAIN));
    assertThat(integerIndexed.defaultExpression(), is(nullValue()));
    Reference integerIndexedBWC = md.references().get(new ColumnIdent("integerIndexedBWC"));
    assertThat(integerIndexedBWC.indexType(), is(Reference.IndexType.PLAIN));
    assertThat(integerIndexedBWC.defaultExpression(), is(nullValue()));
    Reference integerNotIndexed = md.references().get(new ColumnIdent("integerNotIndexed"));
    assertThat(integerNotIndexed.indexType(), is(Reference.IndexType.NONE));
    assertThat(integerNotIndexed.defaultExpression(), is(nullValue()));
    Reference integerNotIndexedBWC = md.references().get(new ColumnIdent("integerNotIndexedBWC"));
    assertThat(integerNotIndexedBWC.indexType(), is(Reference.IndexType.NONE));
    assertThat(integerNotIndexedBWC.defaultExpression(), is(nullValue()));
    Reference stringNotIndexed = md.references().get(new ColumnIdent("stringNotIndexed"));
    assertThat(stringNotIndexed.indexType(), is(Reference.IndexType.NONE));
    assertThat(stringNotIndexed.defaultExpression(), is(nullValue()));
    Reference stringNotIndexedBWC = md.references().get(new ColumnIdent("stringNotIndexedBWC"));
    assertThat(stringNotIndexedBWC.indexType(), is(Reference.IndexType.NONE));
    assertThat(stringNotIndexedBWC.defaultExpression(), is(nullValue()));
    Reference stringNotAnalyzed = md.references().get(new ColumnIdent("stringNotAnalyzed"));
    assertThat(stringNotAnalyzed.indexType(), is(Reference.IndexType.PLAIN));
    assertThat(stringNotAnalyzed.defaultExpression(), is(nullValue()));
    Reference stringNotAnalyzedBWC = md.references().get(new ColumnIdent("stringNotAnalyzedBWC"));
    assertThat(stringNotAnalyzedBWC.indexType(), is(Reference.IndexType.PLAIN));
    assertThat(stringNotAnalyzedBWC.defaultExpression(), is(nullValue()));
    Reference stringAnalyzed = md.references().get(new ColumnIdent("stringAnalyzed"));
    assertThat(stringAnalyzed.indexType(), is(Reference.IndexType.FULLTEXT));
    assertThat(stringAnalyzed.defaultExpression(), is(nullValue()));
    Reference stringAnalyzedBWC = md.references().get(new ColumnIdent("stringAnalyzedBWC"));
    assertThat(stringAnalyzedBWC.indexType(), is(Reference.IndexType.FULLTEXT));
    assertThat(stringAnalyzedBWC.defaultExpression(), is(nullValue()));
    assertThat(Lists2.map(md.references().values(), r -> r.column().fqn()), containsInAnyOrder("_doc", "_fetchid", "_id", "_raw", "_score", "_uid", "_version", "_docid", "_seq_no", "_primary_term", "integerIndexed", "integerIndexedBWC", "integerNotIndexed", "integerNotIndexedBWC", "person", "person.birthday", "person.first_name", "stringAnalyzed", "stringAnalyzedBWC", "stringNotAnalyzed", "stringNotAnalyzedBWC", "stringNotIndexed", "stringNotIndexedBWC"));
}
Also used : ParamTypeHints(io.crate.analyze.ParamTypeHints) Arrays(java.util.Arrays) SessionContext(io.crate.action.sql.SessionContext) RelationName(io.crate.metadata.RelationName) IndexMetadata(org.elasticsearch.cluster.metadata.IndexMetadata) Environment(org.elasticsearch.env.Environment) Matchers.not(org.hamcrest.Matchers.not) UserDefinedFunctionService(io.crate.expression.udf.UserDefinedFunctionService) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) Matchers.hasItems(org.hamcrest.Matchers.hasItems) Matchers.hasKey(org.hamcrest.Matchers.hasKey) ArrayType(io.crate.types.ArrayType) Settings(org.elasticsearch.common.settings.Settings) Map(java.util.Map) Matchers.nullValue(org.hamcrest.Matchers.nullValue) CreateTableStatementAnalyzer(io.crate.analyze.CreateTableStatementAnalyzer) Path(java.nio.file.Path) TestingHelpers.createNodeContext(io.crate.testing.TestingHelpers.createNodeContext) BoundCreateTable(io.crate.analyze.BoundCreateTable) FulltextAnalyzerResolver(io.crate.metadata.FulltextAnalyzerResolver) AnalyzedCreateTable(io.crate.analyze.AnalyzedCreateTable) NodeContext(io.crate.metadata.NodeContext) GeneratedReference(io.crate.metadata.GeneratedReference) SymbolMatchers.isFunction(io.crate.testing.SymbolMatchers.isFunction) AnalysisRegistry(org.elasticsearch.index.analysis.AnalysisRegistry) BytesReference(org.elasticsearch.common.bytes.BytesReference) Collectors(java.util.stream.Collectors) Lists2(io.crate.common.collections.Lists2) CheckConstraint(io.crate.sql.tree.CheckConstraint) IsCollectionWithSize.hasSize(org.hamcrest.collection.IsCollectionWithSize.hasSize) SymbolMatchers.isReference(io.crate.testing.SymbolMatchers.isReference) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) List(java.util.List) Row(io.crate.data.Row) MappingMetadata(org.elasticsearch.cluster.metadata.MappingMetadata) Matchers.contains(org.hamcrest.Matchers.contains) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) DataTypes(io.crate.types.DataTypes) Matchers.equalTo(org.hamcrest.Matchers.equalTo) SubQueryResults(io.crate.planner.operators.SubQueryResults) Statement(io.crate.sql.tree.Statement) Matchers.is(org.hamcrest.Matchers.is) Expression(io.crate.sql.tree.Expression) CoordinatorTxnCtx(io.crate.metadata.CoordinatorTxnCtx) XContentFactory(org.elasticsearch.common.xcontent.XContentFactory) XContentType(org.elasticsearch.common.xcontent.XContentType) Analysis(io.crate.analyze.Analysis) ViewInfoFactory(io.crate.metadata.view.ViewInfoFactory) HashMap(java.util.HashMap) ObjectType(io.crate.types.ObjectType) IndexReference(io.crate.metadata.IndexReference) ArrayList(java.util.ArrayList) XContentHelper(org.elasticsearch.common.xcontent.XContentHelper) Constants(io.crate.Constants) CreateTablePlan(io.crate.planner.node.ddl.CreateTablePlan) ColumnPolicy(io.crate.sql.tree.ColumnPolicy) SqlParser(io.crate.sql.parser.SqlParser) Before(org.junit.Before) CreateTable(io.crate.sql.tree.CreateTable) Collections.emptyMap(java.util.Collections.emptyMap) StringType(io.crate.types.StringType) ColumnIdent(io.crate.metadata.ColumnIdent) Reference(io.crate.metadata.Reference) DataType(io.crate.types.DataType) Matchers(org.hamcrest.Matchers) Test(org.junit.Test) IOException(java.io.IOException) NumberOfShards(io.crate.analyze.NumberOfShards) TreeMap(java.util.TreeMap) Schemas(io.crate.metadata.Schemas) IndexNameExpressionResolver(org.elasticsearch.cluster.metadata.IndexNameExpressionResolver) SymbolMatchers.isLiteral(io.crate.testing.SymbolMatchers.isLiteral) ColumnIdent(io.crate.metadata.ColumnIdent) GeneratedReference(io.crate.metadata.GeneratedReference) BytesReference(org.elasticsearch.common.bytes.BytesReference) SymbolMatchers.isReference(io.crate.testing.SymbolMatchers.isReference) IndexReference(io.crate.metadata.IndexReference) Reference(io.crate.metadata.Reference) IndexMetadata(org.elasticsearch.cluster.metadata.IndexMetadata) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest) Test(org.junit.Test)

Example 9 with Lists2.mapTail

use of io.crate.common.collections.Lists2.mapTail in project crate by crate.

the class SQLPrinter method print.

public static String print(QueriedSelectRelation relation) {
    StringBuilder sb = new StringBuilder();
    sb.append("SELECT ");
    sb.append(Lists2.joinOn(", ", relation.outputs(), x -> x.toString(Style.QUALIFIED)));
    if (relation.where() != Literal.BOOLEAN_TRUE) {
        sb.append(" WHERE ");
        sb.append(relation.where().toString(Style.QUALIFIED));
    }
    if (!relation.groupBy().isEmpty()) {
        sb.append(" GROUP BY ");
        sb.append(Lists2.joinOn(", ", relation.groupBy(), x -> x.toString(Style.QUALIFIED)));
    }
    Symbol having = relation.having();
    if (having != null) {
        sb.append(" HAVING ");
        sb.append(having.toString(Style.QUALIFIED));
    }
    OrderBy orderBy = relation.orderBy();
    if (orderBy != null) {
        sb.append(" ORDER BY ");
        process(orderBy, sb);
    }
    Symbol limit = relation.limit();
    if (limit != null) {
        sb.append(" LIMIT ");
        sb.append(print(limit));
    }
    Symbol offset = relation.offset();
    if (offset != null) {
        sb.append(" OFFSET ");
        sb.append(print(offset));
    }
    return sb.toString();
}
Also used : HashSet(java.util.HashSet) OrderBy(io.crate.analyze.OrderBy) Literal(io.crate.expression.symbol.Literal) Symbol(io.crate.expression.symbol.Symbol) WhereClause(io.crate.analyze.WhereClause) Collection(java.util.Collection) QueriedSelectRelation(io.crate.analyze.QueriedSelectRelation) Style(io.crate.expression.symbol.format.Style) Lists2(io.crate.common.collections.Lists2) Ordering(io.crate.common.collections.Ordering) OrderBy(io.crate.analyze.OrderBy) Symbol(io.crate.expression.symbol.Symbol)

Example 10 with Lists2.mapTail

use of io.crate.common.collections.Lists2.mapTail in project crate by crate.

the class AbstractWindowFunctionTest method assertEvaluate.

@SuppressWarnings("unchecked")
protected <T> void assertEvaluate(String functionExpression, Matcher<T> expectedValue, List<ColumnIdent> rowsColumnDescription, Object[]... inputRows) throws Throwable {
    performInputSanityChecks(inputRows);
    Symbol normalizedFunctionSymbol = sqlExpressions.normalize(sqlExpressions.asSymbol(functionExpression));
    assertThat(normalizedFunctionSymbol, instanceOf(io.crate.expression.symbol.WindowFunction.class));
    var windowFunctionSymbol = (io.crate.expression.symbol.WindowFunction) normalizedFunctionSymbol;
    ReferenceResolver<InputCollectExpression> referenceResolver = r -> new InputCollectExpression(rowsColumnDescription.indexOf(r.column()));
    var sourceSymbols = Lists2.map(rowsColumnDescription, x -> sqlExpressions.normalize(sqlExpressions.asSymbol(x.sqlFqn())));
    ensureInputRowsHaveCorrectType(sourceSymbols, inputRows);
    var argsCtx = inputFactory.ctxForRefs(txnCtx, referenceResolver);
    argsCtx.add(windowFunctionSymbol.arguments());
    FunctionImplementation impl = sqlExpressions.nodeCtx.functions().getQualified(windowFunctionSymbol, txnCtx.sessionSettings().searchPath());
    assert impl instanceof WindowFunction || impl instanceof AggregationFunction : "Got " + impl + " but expected a window function";
    WindowFunction windowFunctionImpl;
    if (impl instanceof AggregationFunction) {
        windowFunctionImpl = new AggregateToWindowFunctionAdapter((AggregationFunction) impl, new ExpressionsInput<>(Literal.BOOLEAN_TRUE, List.of()), Version.CURRENT, RamAccounting.NO_ACCOUNTING, memoryManager, Version.CURRENT);
    } else {
        windowFunctionImpl = (WindowFunction) impl;
    }
    int numCellsInSourceRows = inputRows[0].length;
    var windowDef = windowFunctionSymbol.windowDefinition();
    var partitionOrderBy = windowDef.partitions().isEmpty() ? null : new OrderBy(windowDef.partitions());
    Comparator<Object[]> cmpOrderBy = createComparator(() -> inputFactory.ctxForRefs(txnCtx, referenceResolver), windowDef.orderBy());
    InputColumns.SourceSymbols inputColSources = new InputColumns.SourceSymbols(sourceSymbols);
    var mappedWindowDef = windowDef.map(s -> InputColumns.create(s, inputColSources));
    BatchIterator<Row> iterator = WindowFunctionBatchIterator.of(InMemoryBatchIterator.of(Arrays.stream(inputRows).map(RowN::new).collect(Collectors.toList()), SENTINEL, true), new IgnoreRowAccounting(), WindowProjector.createComputeStartFrameBoundary(numCellsInSourceRows, txnCtx, sqlExpressions.nodeCtx, mappedWindowDef, cmpOrderBy), WindowProjector.createComputeEndFrameBoundary(numCellsInSourceRows, txnCtx, sqlExpressions.nodeCtx, mappedWindowDef, cmpOrderBy), createComparator(() -> inputFactory.ctxForRefs(txnCtx, referenceResolver), partitionOrderBy), cmpOrderBy, numCellsInSourceRows, () -> 1, Runnable::run, List.of(windowFunctionImpl), argsCtx.expressions(), new Boolean[] { windowFunctionSymbol.ignoreNulls() }, argsCtx.topLevelInputs().toArray(new Input[0]));
    List<Object> actualResult;
    try {
        actualResult = BatchIterators.collect(iterator, Collectors.mapping(row -> row.get(numCellsInSourceRows), Collectors.toList())).get(5, TimeUnit.SECONDS);
    } catch (ExecutionException e) {
        throw e.getCause();
    }
    assertThat((T) actualResult, expectedValue);
}
Also used : Input(io.crate.data.Input) TransactionContext(io.crate.metadata.TransactionContext) SqlExpressions(io.crate.testing.SqlExpressions) Arrays(java.util.Arrays) Array(java.lang.reflect.Array) RelationName(io.crate.metadata.RelationName) SENTINEL(io.crate.data.SentinelRow.SENTINEL) BatchIterator(io.crate.data.BatchIterator) ReferenceResolver(io.crate.expression.reference.ReferenceResolver) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest) RowN(io.crate.data.RowN) Map(java.util.Map) SQLExecutor(io.crate.testing.SQLExecutor) Before(org.junit.Before) DocTableInfo(io.crate.metadata.doc.DocTableInfo) User(io.crate.user.User) AbstractModule(org.elasticsearch.common.inject.AbstractModule) AggregationFunction(io.crate.execution.engine.aggregation.AggregationFunction) InMemoryBatchIterator(io.crate.data.InMemoryBatchIterator) ColumnIdent(io.crate.metadata.ColumnIdent) Comparators.createComparator(io.crate.execution.engine.sort.Comparators.createComparator) RamAccounting(io.crate.breaker.RamAccounting) Collectors(java.util.stream.Collectors) Lists2(io.crate.common.collections.Lists2) InputCollectExpression(io.crate.execution.engine.collect.InputCollectExpression) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) ExpressionsInput(io.crate.expression.ExpressionsInput) List(java.util.List) OrderBy(io.crate.analyze.OrderBy) BatchIterators(io.crate.data.BatchIterators) Version(org.elasticsearch.Version) DocTableRelation(io.crate.analyze.relations.DocTableRelation) Row(io.crate.data.Row) Literal(io.crate.expression.symbol.Literal) Symbol(io.crate.expression.symbol.Symbol) FunctionImplementation(io.crate.metadata.FunctionImplementation) Matcher(org.hamcrest.Matcher) AnalyzedRelation(io.crate.analyze.relations.AnalyzedRelation) InputColumns(io.crate.execution.dsl.projection.builder.InputColumns) OnHeapMemoryManager(io.crate.memory.OnHeapMemoryManager) InputFactory(io.crate.expression.InputFactory) Comparator(java.util.Comparator) CoordinatorTxnCtx(io.crate.metadata.CoordinatorTxnCtx) Symbol(io.crate.expression.symbol.Symbol) AggregationFunction(io.crate.execution.engine.aggregation.AggregationFunction) Input(io.crate.data.Input) ExpressionsInput(io.crate.expression.ExpressionsInput) InputCollectExpression(io.crate.execution.engine.collect.InputCollectExpression) FunctionImplementation(io.crate.metadata.FunctionImplementation) ExecutionException(java.util.concurrent.ExecutionException) OrderBy(io.crate.analyze.OrderBy) InputColumns(io.crate.execution.dsl.projection.builder.InputColumns) Row(io.crate.data.Row) ExpressionsInput(io.crate.expression.ExpressionsInput)

Aggregations

Lists2 (io.crate.common.collections.Lists2)21 Symbol (io.crate.expression.symbol.Symbol)17 List (java.util.List)17 CoordinatorTxnCtx (io.crate.metadata.CoordinatorTxnCtx)13 Map (java.util.Map)13 NodeContext (io.crate.metadata.NodeContext)12 ArrayList (java.util.ArrayList)12 Row (io.crate.data.Row)10 DocTableInfo (io.crate.metadata.doc.DocTableInfo)10 Nullable (javax.annotation.Nullable)10 RelationName (io.crate.metadata.RelationName)8 SubQueryResults (io.crate.planner.operators.SubQueryResults)8 HashMap (java.util.HashMap)8 Function (java.util.function.Function)8 Literal (io.crate.expression.symbol.Literal)7 PlannerContext (io.crate.planner.PlannerContext)7 DataType (io.crate.types.DataType)7 Schemas (io.crate.metadata.Schemas)6 RowConsumer (io.crate.data.RowConsumer)5 EvaluatingNormalizer (io.crate.expression.eval.EvaluatingNormalizer)5