use of io.confluent.ksql.execution.expression.tree.SubscriptExpression in project ksql by confluentinc.
the class ExpressionTypeManagerTest method shouldEvaluateTypeForStructDereferenceInArray.
@Test
public void shouldEvaluateTypeForStructDereferenceInArray() {
// Given:
final SqlStruct inner = SqlTypes.struct().field("IN0", SqlTypes.INTEGER).build();
final LogicalSchema schema = LogicalSchema.builder().keyColumn(SystemColumns.ROWKEY_NAME, SqlTypes.STRING).valueColumn(COL0, SqlTypes.array(inner)).build();
expressionTypeManager = new ExpressionTypeManager(schema, functionRegistry);
final Expression expression = new DereferenceExpression(Optional.empty(), new SubscriptExpression(TestExpressions.COL0, new IntegerLiteral(1)), "IN0");
// When:
final SqlType result = expressionTypeManager.getExpressionSqlType(expression);
// Then:
assertThat(result, is(SqlTypes.INTEGER));
}
Aggregations