use of io.confluent.ksql.execution.expression.tree.NullLiteral in project ksql by confluentinc.
the class QueryFilterNodeTest method shouldExtractKeyValueFromNullLiteral.
@Test
public void shouldExtractKeyValueFromNullLiteral() {
// Given:
final Expression expression = new ComparisonExpression(Type.EQUAL, new UnqualifiedColumnReferenceExp(ColumnName.of("K")), new NullLiteral());
// When:
final KsqlException e = assertThrows(KsqlException.class, () -> new QueryFilterNode(NODE_ID, source, expression, metaStore, ksqlConfig, false, plannerOptions));
// Then:
assertThat(e.getMessage(), containsString("Primary key columns can not be NULL: (K = null)"));
}
use of io.confluent.ksql.execution.expression.tree.NullLiteral in project ksql by confluentinc.
the class GenericRecordFactoryTest method shouldAcceptNullsForAnyColumn.
@Test
public void shouldAcceptNullsForAnyColumn() {
// Given:
final LogicalSchema schema = LogicalSchema.builder().keyColumn(KEY, SqlTypes.STRING).valueColumn(COL0, SqlTypes.BIGINT).build();
final List<ColumnName> names = ImmutableList.of(KEY, COL0);
// When:
final KsqlGenericRecord record = recordFactory.build(names, ImmutableList.of(new NullLiteral(), new NullLiteral()), schema, DataSourceType.KSTREAM);
// Then:
assertThat(record, is(KsqlGenericRecord.of(GenericKey.genericKey((Object) null), GenericRow.genericRow((Object) null), 0)));
}
use of io.confluent.ksql.execution.expression.tree.NullLiteral in project ksql by confluentinc.
the class PartitionByParamsFactoryTest method shouldBuildResultSchemaWhenPartitioningByNull.
@Test
public void shouldBuildResultSchemaWhenPartitioningByNull() {
// Given:
final List<Expression> partitionBy = ImmutableList.of(new NullLiteral());
// When:
final LogicalSchema resultSchema = PartitionByParamsFactory.buildSchema(SCHEMA, partitionBy, functionRegistry);
// Then:
assertThat(resultSchema, is(LogicalSchema.builder().valueColumn(COL1, SqlTypes.INTEGER).valueColumn(COL2, SqlTypes.INTEGER).valueColumn(COL3, COL3_TYPE).valueColumn(SystemColumns.ROWTIME_NAME, SqlTypes.BIGINT).valueColumn(COL0, SqlTypes.STRING).build()));
}
use of io.confluent.ksql.execution.expression.tree.NullLiteral in project ksql by confluentinc.
the class ExpressionTypeManagerTest method shouldThrowOnArrayAllNulls.
@Test
public void shouldThrowOnArrayAllNulls() {
// Given:
Expression expression = new CreateArrayExpression(ImmutableList.of(new NullLiteral()));
// When:
final Exception e = assertThrows(KsqlException.class, () -> expressionTypeManager.getExpressionSqlType(expression));
// Then:
assertThat(e.getMessage(), containsString("Cannot construct an array with all NULL elements"));
}
use of io.confluent.ksql.execution.expression.tree.NullLiteral in project ksql by confluentinc.
the class ExpressionTypeManagerTest method shouldThrowOnMapOfNullValues.
@Test
public void shouldThrowOnMapOfNullValues() {
// Given:
Expression expression = new CreateMapExpression(ImmutableMap.of(new StringLiteral("foo"), new NullLiteral()));
// When:
final Exception e = assertThrows(KsqlException.class, () -> expressionTypeManager.getExpressionSqlType(expression));
// Then:
assertThat(e.getMessage(), containsString("Cannot construct a map with all NULL values"));
}
Aggregations