Package io.crate.executor

Examples of io.crate.executor.TaskResult


        plan.expectsAffectedRows(true);

        Job job = executor.newJob(plan);
        List<ListenableFuture<TaskResult>> futures = executor.execute(job);
        ListenableFuture<List<TaskResult>> listenableFuture = Futures.allAsList(futures);
        TaskResult taskResult = listenableFuture.get().get(0);
        Object[][] objects = listenableFuture.get().get(0).rows();
        assertThat(taskResult.rowCount(), is(1L));
        assertThat(objects.length, is(0));

        execute("select * from information_schema.tables where table_name = 't'");
        assertThat(response.rowCount(), is(0L));
    }
View Full Code Here


        plan.expectsAffectedRows(true);

        Job job = executor.newJob(plan);
        List<ListenableFuture<TaskResult>> futures = executor.execute(job);
        ListenableFuture<List<TaskResult>> listenableFuture = Futures.allAsList(futures);
        TaskResult taskResult = listenableFuture.get().get(0);
        Object[][] objects = listenableFuture.get().get(0).rows();
        assertThat(taskResult.rowCount(), is(1L));
        assertThat(objects.length, is(0));
        assertEquals("panic", client().admin().cluster().prepareState().execute().actionGet().getState().metaData().persistentSettings().get(persistentSetting));

        // Update transient only
        Settings transientSettings = ImmutableSettings.builder()
                .put(transientSetting, "123")
                .build();

        node = new ESClusterUpdateSettingsNode(EMPTY_SETTINGS, transientSettings);

        plan = new Plan();
        plan.add(node);
        plan.expectsAffectedRows(true);

        job = executor.newJob(plan);
        futures = executor.execute(job);
        listenableFuture = Futures.allAsList(futures);
        taskResult = listenableFuture.get().get(0);
        objects = listenableFuture.get().get(0).rows();
        assertThat(taskResult.rowCount(), is(1L));
        assertThat(objects.length, is(0));
        assertEquals("123", client().admin().cluster().prepareState().execute().actionGet().getState().metaData().transientSettings().get(transientSetting));

        // Update persistent & transient
        persistentSettings = ImmutableSettings.builder()
                .put(persistentSetting, "normal")
                .build();
        transientSettings = ImmutableSettings.builder()
                .put(transientSetting, "243")
                .build();

        node = new ESClusterUpdateSettingsNode(persistentSettings, transientSettings);

        plan = new Plan();
        plan.add(node);
        plan.expectsAffectedRows(true);

        job = executor.newJob(plan);
        futures = executor.execute(job);
        listenableFuture = Futures.allAsList(futures);
        taskResult = listenableFuture.get().get(0);
        objects = listenableFuture.get().get(0).rows();
        assertThat(taskResult.rowCount(), is(1L));
        assertThat(objects.length, is(0));
        assertEquals("normal", client().admin().cluster().prepareState().execute().actionGet().getState().metaData().persistentSettings().get(persistentSetting));
        assertEquals("243", client().admin().cluster().prepareState().execute().actionGet().getState().metaData().transientSettings().get(transientSetting));
    }
View Full Code Here

        plan.expectsAffectedRows(true);

        Job job = executor.newJob(plan);
        List<ListenableFuture<TaskResult>> futures = executor.execute(job);
        ListenableFuture<List<TaskResult>> listenableFuture = Futures.allAsList(futures);
        TaskResult taskResult = listenableFuture.get().get(0);
        Object[][] objects = listenableFuture.get().get(0).rows();
        assertThat(taskResult.rowCount(), is(1L));
        assertThat(objects.length, is(0));

        refresh();

        GetIndexTemplatesResponse response = client().admin().indices()
View Full Code Here

                                                   List<TaskResult> result,
                                                   long requestCreationTime,
                                                   boolean includeTypesOnResponse) {
        assert result.size() == 1;

        TaskResult taskResult = result.get(0);
        Object[][] rows = taskResult.rows();
        long rowCount = 0;
        if (plan.expectsAffectedRows() && taskResult instanceof QueryResult) {
            if (rows.length >= 1 && rows[0].length >= 1) {
                rowCount = ((Number) rows[0][0]).longValue();
            }
        } else {
            rowCount = taskResult.rowCount();
        }

        DataType[] dataTypes = plan.outputTypes().toArray(new DataType[plan.outputTypes().size()]);
        BytesRefUtils.ensureStringTypesAreStrings(dataTypes, rows);
        return new SQLResponse(
View Full Code Here

                                                       long requestCreationTime,
                                                       boolean includeTypesOnResponse) {
        DataType[] dataTypes = plan.outputTypes().toArray(new DataType[plan.outputTypes().size()]);
        SQLBulkResponse.Result[] results = new SQLBulkResponse.Result[result.size()];
        for (int i = 0, resultSize = result.size(); i < resultSize; i++) {
            TaskResult taskResult = result.get(i);
            assert taskResult instanceof RowCountResult : "Query operation not supported with bulk requests";
            results[i] = new SQLBulkResponse.Result(taskResult.errorMessage(), taskResult.rowCount());
        }

        return new SQLBulkResponse(outputNames, results, requestCreationTime, dataTypes, includeTypesOnResponse);
    }
View Full Code Here

TOP

Related Classes of io.crate.executor.TaskResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.