Search in sources :

Example 1 with CastExpression

use of com.yahoo.bullet.query.expressions.CastExpression in project bullet-core by yahoo.

the class CastEvaluatorTest method testConstructor.

@Test
public void testConstructor() {
    CastExpression expression = new CastExpression(new ValueExpression(5), Type.STRING);
    expression.setType(Type.STRING);
    CastEvaluator evaluator = new CastEvaluator(expression);
    Assert.assertTrue(evaluator.value instanceof ValueEvaluator);
    Assert.assertEquals(evaluator.castType, Type.STRING);
    Assert.assertEquals(evaluator.evaluate(RecordBox.get().getRecord()), new TypedObject(Type.STRING, "5"));
}
Also used : TypedObject(com.yahoo.bullet.typesystem.TypedObject) ValueExpression(com.yahoo.bullet.query.expressions.ValueExpression) CastExpression(com.yahoo.bullet.query.expressions.CastExpression) Test(org.testng.annotations.Test)

Aggregations

CastExpression (com.yahoo.bullet.query.expressions.CastExpression)1 ValueExpression (com.yahoo.bullet.query.expressions.ValueExpression)1 TypedObject (com.yahoo.bullet.typesystem.TypedObject)1 Test (org.testng.annotations.Test)1