Search in sources :

Example 16 with Lists2.mapTail

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

the class WindowFunction method toString.

@Override
public String toString(Style style) {
    var builder = new StringBuilder(super.toString(style));
    if (ignoreNulls != null) {
        if (ignoreNulls) {
            builder.append(" IGNORE NULLS");
        } else {
            builder.append(" RESPECT NULLS");
        }
    }
    builder.append(" OVER (");
    var partitions = windowDefinition.partitions();
    if (!partitions.isEmpty()) {
        builder.append("PARTITION BY ");
        builder.append(Lists2.joinOn(", ", partitions, x -> x.toString(style)));
    }
    var orderBy = windowDefinition.orderBy();
    if (orderBy != null) {
        if (!partitions.isEmpty()) {
            builder.append(" ");
        }
        builder.append("ORDER BY ");
        OrderBy.explainRepresentation(builder, orderBy.orderBySymbols(), orderBy.reverseFlags(), orderBy.nullsFirst(), x -> x.toString(style));
    }
    WindowFrameDefinition frameDefinition = windowDefinition.windowFrameDefinition();
    if (frameDefinition != WindowDefinition.RANGE_UNBOUNDED_PRECEDING_CURRENT_ROW) {
        builder.append(" ");
        builder.append(frameDefinition.mode().name());
        builder.append(" BETWEEN ");
        appendFrameBound(builder, style, frameDefinition.start());
        builder.append(" AND ");
        appendFrameBound(builder, style, frameDefinition.end());
    }
    builder.append(")");
    return builder.toString();
}
Also used : StreamOutput(org.elasticsearch.common.io.stream.StreamOutput) AGGREGATE(io.crate.metadata.FunctionType.AGGREGATE) DataType(io.crate.types.DataType) IOException(java.io.IOException) Signature(io.crate.metadata.functions.Signature) FrameBoundDefinition(io.crate.analyze.FrameBoundDefinition) Style(io.crate.expression.symbol.format.Style) WINDOW(io.crate.metadata.FunctionType.WINDOW) Lists2(io.crate.common.collections.Lists2) Objects(java.util.Objects) List(java.util.List) OrderBy(io.crate.analyze.OrderBy) Version(org.elasticsearch.Version) WindowDefinition(io.crate.analyze.WindowDefinition) StreamInput(org.elasticsearch.common.io.stream.StreamInput) WindowFrameDefinition(io.crate.analyze.WindowFrameDefinition) Nullable(javax.annotation.Nullable) WindowFrameDefinition(io.crate.analyze.WindowFrameDefinition)

Example 17 with Lists2.mapTail

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

the class CreateSnapshotPlan method createRequest.

@VisibleForTesting
public static CreateSnapshotRequest createRequest(AnalyzedCreateSnapshot createSnapshot, CoordinatorTxnCtx txnCtx, NodeContext nodeCtx, Row parameters, SubQueryResults subQueryResults, Schemas schemas) {
    Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate(txnCtx, nodeCtx, x, parameters, subQueryResults);
    Settings settings = GenericPropertiesConverter.genericPropertiesToSettings(createSnapshot.properties().map(eval), SnapshotSettings.SETTINGS);
    boolean ignoreUnavailable = IGNORE_UNAVAILABLE.get(settings);
    final HashSet<String> snapshotIndices;
    final HashSet<String> templates = new HashSet<>();
    if (createSnapshot.tables().isEmpty()) {
        for (SchemaInfo schemaInfo : schemas) {
            for (TableInfo tableInfo : schemaInfo.getTables()) {
                // only check for user generated tables
                if (tableInfo instanceof DocTableInfo) {
                    Operation.blockedRaiseException(tableInfo, Operation.READ);
                }
            }
        }
        snapshotIndices = new HashSet<>(AnalyzedCreateSnapshot.ALL_INDICES);
    } else {
        snapshotIndices = new HashSet<>(createSnapshot.tables().size());
        for (Table<Symbol> table : createSnapshot.tables()) {
            DocTableInfo docTableInfo;
            try {
                docTableInfo = (DocTableInfo) schemas.resolveTableInfo(table.getName(), Operation.CREATE_SNAPSHOT, txnCtx.sessionContext().sessionUser(), txnCtx.sessionContext().searchPath());
            } catch (Exception e) {
                if (ignoreUnavailable && e instanceof ResourceUnknownException) {
                    LOGGER.info("Ignore unknown relation '{}' for the '{}' snapshot'", table.getName(), createSnapshot.snapshot());
                    continue;
                } else {
                    throw e;
                }
            }
            if (docTableInfo.isPartitioned()) {
                templates.add(PartitionName.templateName(docTableInfo.ident().schema(), docTableInfo.ident().name()));
            }
            if (table.partitionProperties().isEmpty()) {
                snapshotIndices.addAll(Arrays.asList(docTableInfo.concreteIndices()));
            } else {
                var partitionName = toPartitionName(docTableInfo, Lists2.map(table.partitionProperties(), x -> x.map(eval)));
                if (!docTableInfo.partitions().contains(partitionName)) {
                    if (!ignoreUnavailable) {
                        throw new PartitionUnknownException(partitionName);
                    } else {
                        LOGGER.info("ignoring unknown partition of table '{}' with ident '{}'", partitionName.relationName(), partitionName.ident());
                    }
                } else {
                    snapshotIndices.add(partitionName.asIndexName());
                }
            }
        }
    }
    return new CreateSnapshotRequest(createSnapshot.snapshot().getRepository(), createSnapshot.snapshot().getSnapshotId().getName()).includeGlobalState(createSnapshot.tables().isEmpty()).waitForCompletion(WAIT_FOR_COMPLETION.get(settings)).indices(snapshotIndices.toArray(new String[0])).indicesOptions(IndicesOptions.fromOptions(ignoreUnavailable, true, true, false, IndicesOptions.lenientExpandOpen())).templates(templates.stream().toList()).settings(settings);
}
Also used : Arrays(java.util.Arrays) Operation(io.crate.metadata.table.Operation) SnapshotInfo(org.elasticsearch.snapshots.SnapshotInfo) Function(java.util.function.Function) PartitionName(io.crate.metadata.PartitionName) DependencyCarrier(io.crate.planner.DependencyCarrier) HashSet(java.util.HashSet) WAIT_FOR_COMPLETION(io.crate.analyze.SnapshotSettings.WAIT_FOR_COMPLETION) SymbolEvaluator(io.crate.analyze.SymbolEvaluator) Settings(org.elasticsearch.common.settings.Settings) AnalyzedCreateSnapshot(io.crate.analyze.AnalyzedCreateSnapshot) IndicesOptions(org.elasticsearch.action.support.IndicesOptions) GenericPropertiesConverter(io.crate.analyze.GenericPropertiesConverter) SnapshotState(org.elasticsearch.snapshots.SnapshotState) OneRowActionListener(io.crate.execution.support.OneRowActionListener) PartitionUnknownException(io.crate.exceptions.PartitionUnknownException) PartitionPropertiesAnalyzer.toPartitionName(io.crate.analyze.PartitionPropertiesAnalyzer.toPartitionName) SchemaInfo(io.crate.metadata.table.SchemaInfo) DocTableInfo(io.crate.metadata.doc.DocTableInfo) TableInfo(io.crate.metadata.table.TableInfo) NodeContext(io.crate.metadata.NodeContext) CreateSnapshotException(io.crate.exceptions.CreateSnapshotException) Table(io.crate.sql.tree.Table) ResourceUnknownException(io.crate.exceptions.ResourceUnknownException) CreateSnapshotRequest(org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest) Lists2(io.crate.common.collections.Lists2) SnapshotSettings(io.crate.analyze.SnapshotSettings) RowConsumer(io.crate.data.RowConsumer) Logger(org.apache.logging.log4j.Logger) Row(io.crate.data.Row) Symbol(io.crate.expression.symbol.Symbol) PlannerContext(io.crate.planner.PlannerContext) IGNORE_UNAVAILABLE(io.crate.analyze.SnapshotSettings.IGNORE_UNAVAILABLE) Plan(io.crate.planner.Plan) SubQueryResults(io.crate.planner.operators.SubQueryResults) Schemas(io.crate.metadata.Schemas) VisibleForTesting(io.crate.common.annotations.VisibleForTesting) LogManager(org.apache.logging.log4j.LogManager) Row1(io.crate.data.Row1) CoordinatorTxnCtx(io.crate.metadata.CoordinatorTxnCtx) DocTableInfo(io.crate.metadata.doc.DocTableInfo) PartitionUnknownException(io.crate.exceptions.PartitionUnknownException) Symbol(io.crate.expression.symbol.Symbol) ResourceUnknownException(io.crate.exceptions.ResourceUnknownException) PartitionUnknownException(io.crate.exceptions.PartitionUnknownException) CreateSnapshotException(io.crate.exceptions.CreateSnapshotException) ResourceUnknownException(io.crate.exceptions.ResourceUnknownException) CreateSnapshotRequest(org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest) DocTableInfo(io.crate.metadata.doc.DocTableInfo) TableInfo(io.crate.metadata.table.TableInfo) Settings(org.elasticsearch.common.settings.Settings) SnapshotSettings(io.crate.analyze.SnapshotSettings) HashSet(java.util.HashSet) SchemaInfo(io.crate.metadata.table.SchemaInfo) VisibleForTesting(io.crate.common.annotations.VisibleForTesting)

Example 18 with Lists2.mapTail

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

the class PostgresWireProtocol method handleSingleQuery.

private CompletableFuture<?> handleSingleQuery(Statement statement, DelayableWriteChannel channel) {
    CompletableFuture<?> result = new CompletableFuture<>();
    String query;
    try {
        query = SqlFormatter.formatSql(statement);
    } catch (Exception e) {
        query = statement.toString();
    }
    AccessControl accessControl = getAccessControl.apply(session.sessionContext());
    try {
        session.analyze("", statement, Collections.emptyList(), query);
        session.bind("", "", Collections.emptyList(), null);
        DescribeResult describeResult = session.describe('P', "");
        List<Symbol> fields = describeResult.getFields();
        CompletableFuture<?> execute;
        if (fields == null) {
            RowCountReceiver rowCountReceiver = new RowCountReceiver(query, channel.bypassDelay(), accessControl);
            execute = session.execute("", 0, rowCountReceiver);
        } else {
            Messages.sendRowDescription(channel, fields, null, describeResult.relation());
            ResultSetReceiver resultSetReceiver = new ResultSetReceiver(query, channel.bypassDelay(), TransactionState.IDLE, accessControl, Lists2.map(fields, x -> PGTypes.get(x.valueType())), null);
            execute = session.execute("", 0, resultSetReceiver);
        }
        if (execute != null) {
            channel.delayWritesUntil(execute);
        }
        return session.sync();
    } catch (Throwable t) {
        Messages.sendErrorResponse(channel, accessControl, t);
        result.completeExceptionally(t);
        return result;
    }
}
Also used : SessionContext(io.crate.action.sql.SessionContext) PGTypes(io.crate.protocols.postgres.types.PGTypes) ByteBuffer(java.nio.ByteBuffer) InetAddress(java.net.InetAddress) STARTUP_HEADER(io.crate.protocols.postgres.PostgresWireProtocol.State.STARTUP_HEADER) Locale(java.util.Locale) SQLOperations(io.crate.action.sql.SQLOperations) User(io.crate.user.User) Collection(java.util.Collection) SqlFormatter(io.crate.sql.SqlFormatter) ChannelPipeline(io.netty.channel.ChannelPipeline) Lists2(io.crate.common.collections.Lists2) StandardCharsets(java.nio.charset.StandardCharsets) List(java.util.List) FormatCodes.getFormatCode(io.crate.protocols.postgres.FormatCodes.getFormatCode) Session(io.crate.action.sql.Session) Logger(org.apache.logging.log4j.Logger) Version(org.elasticsearch.Version) PRE_STARTUP(io.crate.protocols.postgres.PostgresWireProtocol.State.PRE_STARTUP) Symbol(io.crate.expression.symbol.Symbol) Statement(io.crate.sql.tree.Statement) DescribeResult(io.crate.action.sql.DescribeResult) SslContextProvider(io.crate.protocols.ssl.SslContextProvider) VisibleForTesting(io.crate.common.annotations.VisibleForTesting) AccessControl(io.crate.auth.AccessControl) PGType(io.crate.protocols.postgres.types.PGType) Netty4HttpServerTransport(org.elasticsearch.http.netty4.Netty4HttpServerTransport) CompletableFuture(java.util.concurrent.CompletableFuture) Function(java.util.function.Function) ArrayList(java.util.ArrayList) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) SocketException(java.net.SocketException) SSLSession(javax.net.ssl.SSLSession) ByteBuf(io.netty.buffer.ByteBuf) BiConsumer(java.util.function.BiConsumer) SqlParser(io.crate.sql.parser.SqlParser) Authentication(io.crate.auth.Authentication) ByteToMessageDecoder(io.netty.handler.codec.ByteToMessageDecoder) Nullable(javax.annotation.Nullable) Properties(java.util.Properties) AuthenticationMethod(io.crate.auth.AuthenticationMethod) DataType(io.crate.types.DataType) SSL.getSession(io.crate.protocols.SSL.getSession) Channel(io.netty.channel.Channel) Protocol(io.crate.auth.Protocol) SimpleChannelInboundHandler(io.netty.channel.SimpleChannelInboundHandler) LogManager(org.apache.logging.log4j.LogManager) Collections(java.util.Collections) ResultReceiver(io.crate.action.sql.ResultReceiver) CompletableFuture(java.util.concurrent.CompletableFuture) DescribeResult(io.crate.action.sql.DescribeResult) Symbol(io.crate.expression.symbol.Symbol) SocketException(java.net.SocketException) AccessControl(io.crate.auth.AccessControl)

Example 19 with Lists2.mapTail

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

the class SQLIntegrationTestCase method assertFunctionIsCreatedOnAll.

public void assertFunctionIsCreatedOnAll(String schema, String name, List<DataType<?>> argTypes) throws Exception {
    SearchPath searchPath = SearchPath.pathWithPGCatalogAndDoc();
    assertBusy(() -> {
        Iterable<Functions> functions = internalCluster().getInstances(Functions.class);
        for (Functions function : functions) {
            FunctionImplementation func = function.get(schema, name, Lists2.map(argTypes, t -> Literal.of(t, null)), searchPath);
            assertThat(func, is(not(nullValue())));
            assertThat(func.info().ident().argumentTypes(), is(equalTo(argTypes)));
        }
    }, 20L, TimeUnit.SECONDS);
}
Also used : ParamTypeHints(io.crate.analyze.ParamTypeHints) SessionContext(io.crate.action.sql.SessionContext) IndexMetadata(org.elasticsearch.cluster.metadata.IndexMetadata) SessionSettings(io.crate.metadata.settings.SessionSettings) Matchers.not(org.hamcrest.Matchers.not) Inherited(java.lang.annotation.Inherited) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) Analyzer(io.crate.analyze.Analyzer) NodeLimits(io.crate.execution.jobs.NodeLimits) DependencyCarrier(io.crate.planner.DependencyCarrier) Functions(io.crate.metadata.Functions) Matchers.nullValue(org.hamcrest.Matchers.nullValue) Map(java.util.Map) SQLTransportExecutor(io.crate.testing.SQLTransportExecutor) RandomStrings(com.carrotsearch.randomizedtesting.generators.RandomStrings) TableInfo(io.crate.metadata.table.TableInfo) RandomizedContext(com.carrotsearch.randomizedtesting.RandomizedContext) TasksService(io.crate.execution.jobs.TasksService) Logger(org.apache.logging.log4j.Logger) Row(io.crate.data.Row) SubQueryResults(io.crate.planner.operators.SubQueryResults) ClusterStateRequest(org.elasticsearch.action.admin.cluster.state.ClusterStateRequest) Matchers.is(org.hamcrest.Matchers.is) XContentFactory(org.elasticsearch.common.xcontent.XContentFactory) ClusterService(org.elasticsearch.cluster.service.ClusterService) BoundTransportAddress(org.elasticsearch.common.transport.BoundTransportAddress) Metadata(org.elasticsearch.cluster.metadata.Metadata) TestName(org.junit.rules.TestName) Timeout(org.junit.rules.Timeout) IndicesService(org.elasticsearch.indices.IndicesService) Nullable(javax.annotation.Nullable) PSQL_PORT_SETTING(io.crate.protocols.postgres.PostgresNetty.PSQL_PORT_SETTING) Before(org.junit.Before) Identifiers(io.crate.sql.Identifiers) Client(org.elasticsearch.client.Client) IndexService(org.elasticsearch.index.IndexService) IndexShard(org.elasticsearch.index.shard.IndexShard) IOException(java.io.IOException) Planner(io.crate.planner.Planner) Field(java.lang.reflect.Field) RoutingProvider(io.crate.metadata.RoutingProvider) Literal(io.crate.expression.symbol.Literal) PlannerContext(io.crate.planner.PlannerContext) Matcher(org.hamcrest.Matcher) Plan(io.crate.planner.Plan) PostgresNetty(io.crate.protocols.postgres.PostgresNetty) KillableCallable(io.crate.execution.jobs.kill.KillableCallable) Schemas(io.crate.metadata.Schemas) UseJdbc(io.crate.testing.UseJdbc) Randomness(org.elasticsearch.common.Randomness) TransportShardAction(io.crate.execution.dml.TransportShardAction) TransportShardUpsertAction(io.crate.execution.dml.upsert.TransportShardUpsertAction) RelationName(io.crate.metadata.RelationName) UseRandomizedSchema(io.crate.testing.UseRandomizedSchema) Random(java.util.Random) RootTask(io.crate.execution.jobs.RootTask) UseHashJoins(io.crate.testing.UseHashJoins) Settings(org.elasticsearch.common.settings.Settings) TestGroup(com.carrotsearch.randomizedtesting.annotations.TestGroup) Locale(java.util.Locale) After(org.junit.After) Documented(java.lang.annotation.Documented) ThreadPool(org.elasticsearch.threadpool.ThreadPool) Method(java.lang.reflect.Method) SQLOperations(io.crate.action.sql.SQLOperations) NodeContext(io.crate.metadata.NodeContext) User(io.crate.user.User) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) UUID(java.util.UUID) Netty4Plugin(org.elasticsearch.transport.Netty4Plugin) InetSocketAddress(java.net.InetSocketAddress) Lists2(io.crate.common.collections.Lists2) List(java.util.List) Session(io.crate.action.sql.Session) ESIntegTestCase(org.elasticsearch.test.ESIntegTestCase) Symbol(io.crate.expression.symbol.Symbol) FunctionImplementation(io.crate.metadata.FunctionImplementation) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Annotation(java.lang.annotation.Annotation) TimeValue(io.crate.common.unit.TimeValue) Paging(io.crate.data.Paging) TestingRowConsumer(io.crate.testing.TestingRowConsumer) CoordinatorTxnCtx(io.crate.metadata.CoordinatorTxnCtx) UserLookup(io.crate.user.UserLookup) SQLResponse(io.crate.testing.SQLResponse) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) TransportShardDeleteAction(io.crate.execution.dml.delete.TransportShardDeleteAction) SearchPath(io.crate.metadata.SearchPath) Index(org.elasticsearch.index.Index) SETTING_HTTP_COMPRESSION(org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION) TaskId(org.elasticsearch.tasks.TaskId) Retention(java.lang.annotation.Retention) Strings(org.elasticsearch.common.Strings) ElasticsearchTimeoutException(org.elasticsearch.ElasticsearchTimeoutException) Constants(io.crate.Constants) Symbols(io.crate.expression.symbol.Symbols) SqlParser(io.crate.sql.parser.SqlParser) Requests(org.elasticsearch.client.Requests) Listeners(com.carrotsearch.randomizedtesting.annotations.Listeners) TestExecutionConfig(io.crate.testing.TestExecutionConfig) ColumnIdent(io.crate.metadata.ColumnIdent) Plugin(org.elasticsearch.plugins.Plugin) Matchers(org.hamcrest.Matchers) DataType(io.crate.types.DataType) TimeUnit(java.util.concurrent.TimeUnit) ClusterStateResponse(org.elasticsearch.action.admin.cluster.state.ClusterStateResponse) Rule(org.junit.Rule) SystemPropsTestLoggingListener(io.crate.test.integration.SystemPropsTestLoggingListener) LogManager(org.apache.logging.log4j.LogManager) ConfigurationException(org.elasticsearch.common.inject.ConfigurationException) RetentionPolicy(java.lang.annotation.RetentionPolicy) SearchPath(io.crate.metadata.SearchPath) Functions(io.crate.metadata.Functions) FunctionImplementation(io.crate.metadata.FunctionImplementation)

Example 20 with Lists2.mapTail

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

the class TransportSQLActionTest method test_primary_key_lookups_returns_inserted_records.

@Test
public void test_primary_key_lookups_returns_inserted_records() throws Exception {
    int numKeys = randomIntBetween(1, 3);
    Random random = RandomizedContext.current().getRandom();
    StringBuilder createTable = new StringBuilder("CREATE TABLE tbl (");
    ArrayList<DataType<?>> types = new ArrayList<>();
    List<DataType<?>> typeCandidates = DataTypes.PRIMITIVE_TYPES.stream().filter(x -> x.storageSupport() != null).collect(Collectors.toList());
    for (int i = 0; i < numKeys; i++) {
        var type = RandomPicks.randomFrom(random, typeCandidates);
        types.add(type);
        createTable.append("col");
        createTable.append(i);
        createTable.append(' ');
        createTable.append(type.getName());
        createTable.append(" PRIMARY KEY");
        if (i + 1 < numKeys) {
            createTable.append(", ");
        }
    }
    createTable.append(")");
    execute(createTable.toString());
    String insert = "INSERT INTO tbl VALUES (" + String.join(", ", Lists2.map(types, ignored -> "?")) + ")";
    Object[] args = new Object[types.size()];
    for (int i = 0; i < types.size(); i++) {
        var type = types.get(i);
        args[i] = DataTypeTesting.getDataGenerator(type).get();
    }
    execute(insert, args);
    StringBuilder selectInlineValues = new StringBuilder("SELECT 1 FROM tbl WHERE ");
    StringBuilder selectParams = new StringBuilder("SELECT 1 FROM tbl WHERE ");
    for (int i = 0; i < args.length; i++) {
        var arg = args[i];
        selectInlineValues.append("col");
        selectParams.append("col");
        selectInlineValues.append(i);
        selectParams.append(i);
        selectInlineValues.append(" = ");
        if (arg instanceof String) {
            selectInlineValues.append("'");
            selectInlineValues.append(arg);
            selectInlineValues.append("'");
        } else {
            selectInlineValues.append(arg);
        }
        selectParams.append(" = ?");
        if (i + 1 < args.length) {
            selectInlineValues.append(" AND ");
            selectParams.append(" AND ");
        }
    }
    execute(selectParams.toString(), args);
    assertThat(selectParams.toString() + " with values " + Arrays.toString(args) + " must return a record", response.rowCount(), is(1L));
    execute(selectInlineValues.toString());
    assertThat(selectInlineValues.toString() + " must return a record", response.rowCount(), is(1L));
}
Also used : Matchers.arrayContaining(org.hamcrest.Matchers.arrayContaining) Arrays(java.util.Arrays) NOT_FOUND(io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND) UseRandomizedSchema(io.crate.testing.UseRandomizedSchema) Random(java.util.Random) JsonXContent(org.elasticsearch.common.xcontent.json.JsonXContent) Matchers.hasItems(org.hamcrest.Matchers.hasItems) TestingHelpers(io.crate.testing.TestingHelpers) Matchers.closeTo(org.hamcrest.Matchers.closeTo) IndexNotFoundException(org.elasticsearch.index.IndexNotFoundException) ResultSet(java.sql.ResultSet) Locale(java.util.Locale) UNDEFINED_TABLE(io.crate.protocols.postgres.PGErrorStatus.UNDEFINED_TABLE) Map(java.util.Map) Matchers.nullValue(org.hamcrest.Matchers.nullValue) Is.is(org.hamcrest.core.Is.is) NamedXContentRegistry(org.elasticsearch.common.xcontent.NamedXContentRegistry) RandomizedContext(com.carrotsearch.randomizedtesting.RandomizedContext) Matchers.lessThanOrEqualTo(org.hamcrest.Matchers.lessThanOrEqualTo) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Lists2(io.crate.common.collections.Lists2) RandomizedTest.$(com.carrotsearch.randomizedtesting.RandomizedTest.$) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) List(java.util.List) ESIntegTestCase(org.elasticsearch.test.ESIntegTestCase) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) DataTypes(io.crate.types.DataTypes) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) TestingHelpers.printedTable(io.crate.testing.TestingHelpers.printedTable) INTERNAL_ERROR(io.crate.protocols.postgres.PGErrorStatus.INTERNAL_ERROR) Matchers.containsString(org.hamcrest.Matchers.containsString) RandomPicks(com.carrotsearch.randomizedtesting.generators.RandomPicks) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Asserts.assertThrowsMatches(io.crate.testing.Asserts.assertThrowsMatches) BAD_REQUEST(io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST) DeprecationHandler(org.elasticsearch.common.xcontent.DeprecationHandler) DataTypeTesting(io.crate.testing.DataTypeTesting) Properties(java.util.Properties) DataType(io.crate.types.DataType) Matchers(org.hamcrest.Matchers) Test(org.junit.Test) File(java.io.File) Point(org.locationtech.spatial4j.shape.Point) Rule(org.junit.Rule) Paths(java.nio.file.Paths) SQLErrorMatcher.isSQLError(io.crate.testing.SQLErrorMatcher.isSQLError) Statement(java.sql.Statement) SQLExceptions(io.crate.exceptions.SQLExceptions) UseJdbc(io.crate.testing.UseJdbc) TemporaryFolder(org.junit.rules.TemporaryFolder) DriverManager(java.sql.DriverManager) Random(java.util.Random) ArrayList(java.util.ArrayList) DataType(io.crate.types.DataType) Matchers.containsString(org.hamcrest.Matchers.containsString) Point(org.locationtech.spatial4j.shape.Point) Test(org.junit.Test)

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