use of io.confluent.ksql.execution.expression.tree.BytesLiteral in project ksql by confluentinc.
the class InterpretedExpressionTest method shouldEvaluateCastToBytes.
@Test
public void shouldEvaluateCastToBytes() {
// Given:
final Expression cast1 = new Cast(new BytesLiteral(ByteBuffer.wrap(new byte[] { 123 })), new Type(SqlPrimitiveType.of("BYTES")));
// When:
InterpretedExpression interpreter1 = interpreter(cast1);
// Then:
assertThat(interpreter1.evaluate(ROW), is(ByteBuffer.wrap(new byte[] { 123 })));
}
use of io.confluent.ksql.execution.expression.tree.BytesLiteral in project ksql by confluentinc.
the class InterpretedExpressionTest method shouldEvaluateComparisons_bytes.
@Test
public void shouldEvaluateComparisons_bytes() {
// Given:
final Expression expression1 = new ComparisonExpression(ComparisonExpression.Type.GREATER_THAN, BYTESCOL, new BytesLiteral(ByteBuffer.wrap(new byte[] { 123 })));
final Expression expression2 = new ComparisonExpression(ComparisonExpression.Type.LESS_THAN, BYTESCOL, new BytesLiteral(ByteBuffer.wrap(new byte[] { 123 })));
// When:
InterpretedExpression interpreter1 = interpreter(expression1);
InterpretedExpression interpreter2 = interpreter(expression2);
// Then:
assertThat(interpreter1.evaluate(make(14, ByteBuffer.wrap(new byte[] { 123 }))), is(false));
assertThat(interpreter2.evaluate(make(14, ByteBuffer.wrap(new byte[] { 110 }))), is(true));
}
Aggregations