use of io.confluent.ksql.execution.expression.tree.ArithmeticBinaryExpression in project ksql by confluentinc.
the class ExpressionParserTest method shouldParseExpression.
@Test
public void shouldParseExpression() {
// When:
final Expression parsed = ExpressionParser.parseExpression("1 + 2");
// Then:
assertThat(parsed, equalTo(new ArithmeticBinaryExpression(parsed.getLocation(), Operator.ADD, ONE, TWO)));
}
use of io.confluent.ksql.execution.expression.tree.ArithmeticBinaryExpression in project ksql by confluentinc.
the class PartitionByParamsFactoryTest method shouldAppendNewKeyColumnToValueIfPartitioningByKeyExpression.
@Test
public void shouldAppendNewKeyColumnToValueIfPartitioningByKeyExpression() {
// Given:
final Mapper<GenericKey> mapper = partitionBy(ImmutableList.of(new ArithmeticBinaryExpression(Operator.ADD, new UnqualifiedColumnReferenceExp(COL0), new StringLiteral("-foo")))).getMapper();
final ImmutableList<Object> originals = ImmutableList.copyOf(value.values());
// When:
final KeyValue<GenericKey, GenericRow> result = mapper.apply(key, value);
// Then:
assertThat(result.value, is(GenericRow.fromList(originals).append(OLD_KEY + "-foo")));
}
Aggregations