Search in sources :

Example 1 with ColumnExtractor

use of io.confluent.ksql.execution.util.ColumnExtractor in project ksql by confluentinc.

the class PullQueryValidatorTest method shouldThrowWhenSelectClauseContainsDisallowedColumns.

@Test
public void shouldThrowWhenSelectClauseContainsDisallowedColumns() {
    try (MockedStatic<ColumnExtractor> columnExtractor = mockStatic(ColumnExtractor.class)) {
        // Given:
        givenSelectClauseWithDisallowedColumnNames(columnExtractor);
        // When:
        final Exception e = assertThrows(KsqlException.class, () -> validator.validate(analysis));
        // Then:
        assertThat(e.getMessage(), containsString("Pull queries don't support the following columns in SELECT clauses: `ROWPARTITION`, `ROWOFFSET`"));
    }
}
Also used : ColumnExtractor(io.confluent.ksql.execution.util.ColumnExtractor) KsqlException(io.confluent.ksql.util.KsqlException) Test(org.junit.Test)

Example 2 with ColumnExtractor

use of io.confluent.ksql.execution.util.ColumnExtractor in project ksql by confluentinc.

the class ScalablePushUtilTest method isScalablePushQuery_false_hasWindow.

@Test
public void isScalablePushQuery_false_hasWindow() {
    try (MockedStatic<ColumnExtractor> columnExtractor = mockStatic(ColumnExtractor.class)) {
        // When:
        expectIsSPQ(ColumnName.of("foo"), columnExtractor);
        when(query.getWindow()).thenReturn(Optional.of(new WindowExpression("foo", new TumblingWindowExpression(new WindowTimeClause(1, TimeUnit.MILLISECONDS)))));
        // Then:
        assertThat(ScalablePushUtil.isScalablePushQuery(query, ksqlEngine, ksqlConfig, ImmutableMap.of(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest")), equalTo(false));
    }
}
Also used : ColumnExtractor(io.confluent.ksql.execution.util.ColumnExtractor) TumblingWindowExpression(io.confluent.ksql.execution.windows.TumblingWindowExpression) WindowExpression(io.confluent.ksql.parser.tree.WindowExpression) WindowTimeClause(io.confluent.ksql.execution.windows.WindowTimeClause) TumblingWindowExpression(io.confluent.ksql.execution.windows.TumblingWindowExpression) Test(org.junit.Test)

Example 3 with ColumnExtractor

use of io.confluent.ksql.execution.util.ColumnExtractor in project ksql by confluentinc.

the class PullQueryValidatorTest method shouldThrowWhenWhereClauseContainsDisallowedColumns.

@Test
public void shouldThrowWhenWhereClauseContainsDisallowedColumns() {
    try (MockedStatic<ColumnExtractor> columnExtractor = mockStatic(ColumnExtractor.class)) {
        // Given:
        givenWhereClauseWithDisallowedColumnNames(columnExtractor);
        // When:
        final Exception e = assertThrows(KsqlException.class, () -> validator.validate(analysis));
        // Then:
        assertThat(e.getMessage(), containsString("Pull queries don't support the following columns in WHERE clauses: `ROWPARTITION`, `ROWOFFSET`"));
    }
}
Also used : ColumnExtractor(io.confluent.ksql.execution.util.ColumnExtractor) KsqlException(io.confluent.ksql.util.KsqlException) Test(org.junit.Test)

Aggregations

ColumnExtractor (io.confluent.ksql.execution.util.ColumnExtractor)3 Test (org.junit.Test)3 KsqlException (io.confluent.ksql.util.KsqlException)2 TumblingWindowExpression (io.confluent.ksql.execution.windows.TumblingWindowExpression)1 WindowTimeClause (io.confluent.ksql.execution.windows.WindowTimeClause)1 WindowExpression (io.confluent.ksql.parser.tree.WindowExpression)1