Search in sources :

Example 1 with TypedResult

use of org.apache.flink.table.client.gateway.TypedResult in project flink by apache.

the class CliTableauResultViewTest method testEmptyBatchResult.

@Test
public void testEmptyBatchResult() {
    final Configuration testConfig = new Configuration();
    testConfig.set(EXECUTION_RESULT_MODE, ResultMode.TABLEAU);
    testConfig.set(RUNTIME_MODE, RuntimeExecutionMode.BATCH);
    ResultDescriptor resultDescriptor = new ResultDescriptor("", schema, true, testConfig, rowDataToStringConverter);
    TestingExecutor mockExecutor = new TestingExecutorBuilder().setResultChangesSupplier(TypedResult::endOfStream).setResultPageSupplier(() -> {
        throw new SqlExecutionException("query failed");
    }).build();
    CliTableauResultView view = new CliTableauResultView(terminal, mockExecutor, "session", resultDescriptor);
    view.displayResults();
    view.close();
    Assert.assertEquals("Empty set" + System.lineSeparator(), terminalOutput.toString());
    assertThat(mockExecutor.getNumCancelCalls(), is(0));
}
Also used : SqlExecutionException(org.apache.flink.table.client.gateway.SqlExecutionException) Configuration(org.apache.flink.configuration.Configuration) ResultDescriptor(org.apache.flink.table.client.gateway.ResultDescriptor) TypedResult(org.apache.flink.table.client.gateway.TypedResult) Test(org.junit.Test)

Aggregations

Configuration (org.apache.flink.configuration.Configuration)1 ResultDescriptor (org.apache.flink.table.client.gateway.ResultDescriptor)1 SqlExecutionException (org.apache.flink.table.client.gateway.SqlExecutionException)1 TypedResult (org.apache.flink.table.client.gateway.TypedResult)1 Test (org.junit.Test)1