Search in sources :

Example 51 with LongLiteral

use of io.confluent.ksql.execution.expression.tree.LongLiteral in project ksql by confluentinc.

the class GroupByParamsFactoryTest method setUp.

@Before
public void setUp() {
    when(groupBy0.getExpression()).thenReturn(new LongLiteral(0));
    when(groupBy0.getExpressionType()).thenReturn(SqlTypes.INTEGER);
    when(groupBy1.getExpression()).thenReturn(new UnqualifiedColumnReferenceExp(ColumnName.of("K1")));
    when(groupBy1.getExpressionType()).thenReturn(SqlTypes.INTEGER);
    singleParams = GroupByParamsFactory.build(SOURCE_SCHEMA, ImmutableList.of(groupBy0), logger);
    multiParams = GroupByParamsFactory.build(SOURCE_SCHEMA, ImmutableList.of(groupBy0, groupBy1), logger);
    when(groupBy0.evaluate(any(), any(), any(), any())).thenReturn(0);
    when(groupBy1.evaluate(any(), any(), any(), any())).thenReturn(0L);
}
Also used : LongLiteral(io.confluent.ksql.execution.expression.tree.LongLiteral) UnqualifiedColumnReferenceExp(io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp) Before(org.junit.Before)

Example 52 with LongLiteral

use of io.confluent.ksql.execution.expression.tree.LongLiteral in project ksql by confluentinc.

the class GroupByParamsV1FactoryTest method shouldGenerateKeyNameFromSingleGroupByOtherExpressionType.

@Test
public void shouldGenerateKeyNameFromSingleGroupByOtherExpressionType() {
    // Given:
    when(groupBy0.getExpression()).thenReturn(new LongLiteral(1));
    // When:
    final LogicalSchema schema = GroupByParamsV1Factory.buildSchema(SOURCE_SCHEMA, ImmutableList.of(groupBy0));
    // Then:
    assertThat(schema, is(LogicalSchema.builder().keyColumn(ColumnName.of("KSQL_COL_1"), SqlTypes.INTEGER).valueColumns(SOURCE_SCHEMA.value()).build()));
}
Also used : LongLiteral(io.confluent.ksql.execution.expression.tree.LongLiteral) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) Test(org.junit.Test)

Example 53 with LongLiteral

use of io.confluent.ksql.execution.expression.tree.LongLiteral in project ksql by confluentinc.

the class GroupByParamsV1FactoryTest method setUp.

@Before
public void setUp() {
    when(groupBy0.getExpression()).thenReturn(new LongLiteral(0));
    when(groupBy0.getExpressionType()).thenReturn(SqlTypes.INTEGER);
    singleParams = GroupByParamsV1Factory.build(SOURCE_SCHEMA, ImmutableList.of(groupBy0), logger);
    multiParams = GroupByParamsV1Factory.build(SOURCE_SCHEMA, ImmutableList.of(groupBy0, groupBy1), logger);
    when(groupBy0.evaluate(any(), any(), any(), any())).thenReturn(0);
    when(groupBy1.evaluate(any(), any(), any(), any())).thenReturn(0L);
}
Also used : LongLiteral(io.confluent.ksql.execution.expression.tree.LongLiteral) Before(org.junit.Before)

Aggregations

LongLiteral (io.confluent.ksql.execution.expression.tree.LongLiteral)53 Test (org.junit.Test)49 StringLiteral (io.confluent.ksql.execution.expression.tree.StringLiteral)35 KsqlException (io.confluent.ksql.util.KsqlException)21 InsertValues (io.confluent.ksql.parser.tree.InsertValues)20 RestClientException (io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException)17 ExecutionException (java.util.concurrent.ExecutionException)17 SerializationException (org.apache.kafka.common.errors.SerializationException)17 TopicAuthorizationException (org.apache.kafka.common.errors.TopicAuthorizationException)17 Expression (io.confluent.ksql.execution.expression.tree.Expression)16 IntegerLiteral (io.confluent.ksql.execution.expression.tree.IntegerLiteral)15 CreateArrayExpression (io.confluent.ksql.execution.expression.tree.CreateArrayExpression)12 CreateMapExpression (io.confluent.ksql.execution.expression.tree.CreateMapExpression)12 CreateStructExpression (io.confluent.ksql.execution.expression.tree.CreateStructExpression)12 ComparisonExpression (io.confluent.ksql.execution.expression.tree.ComparisonExpression)10 DoubleLiteral (io.confluent.ksql.execution.expression.tree.DoubleLiteral)10 DecimalLiteral (io.confluent.ksql.execution.expression.tree.DecimalLiteral)9 SearchedCaseExpression (io.confluent.ksql.execution.expression.tree.SearchedCaseExpression)9 BigDecimal (java.math.BigDecimal)9 ArithmeticBinaryExpression (io.confluent.ksql.execution.expression.tree.ArithmeticBinaryExpression)7