use of com.yahoo.document.datatypes.LongFieldValue in project vespa by vespa-engine.
the class Base64DecodeTestCase method requireThatInputIsDecoded.
@Test
public void requireThatInputIsDecoded() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
ctx.setValue(new StringFieldValue("zcIoHQ"));
new Base64DecodeExpression().execute(ctx);
FieldValue val = ctx.getValue();
assertTrue(val instanceof LongFieldValue);
assertEquals(489210573L, ((LongFieldValue) val).getLong());
}
use of com.yahoo.document.datatypes.LongFieldValue in project vespa by vespa-engine.
the class Base64EncodeTestCase method requireThatInputIsEncoded.
@Test
public void requireThatInputIsEncoded() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
ctx.setValue(new LongFieldValue(489210573L));
new Base64EncodeExpression().execute(ctx);
FieldValue val = ctx.getValue();
assertTrue(val instanceof StringFieldValue);
assertEquals("zcIoHQAAAAA=", ((StringFieldValue) val).getString());
}
use of com.yahoo.document.datatypes.LongFieldValue in project vespa by vespa-engine.
the class HexDecodeTestCase method requireThatLargeInputIsDecoded.
@Test
public void requireThatLargeInputIsDecoded() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
ctx.setValue(new StringFieldValue("ff7a3c87fd74abff"));
new HexDecodeExpression().execute(ctx);
FieldValue val = ctx.getValue();
assertTrue(val instanceof LongFieldValue);
assertEquals(-37651092108694529L, ((LongFieldValue) val).getLong());
}
use of com.yahoo.document.datatypes.LongFieldValue in project vespa by vespa-engine.
the class HexEncodeExpression method doExecute.
@Override
protected void doExecute(ExecutionContext ctx) {
long input = ((LongFieldValue) ctx.getValue()).getLong();
ctx.setValue(new StringFieldValue(Long.toHexString(input)));
}
use of com.yahoo.document.datatypes.LongFieldValue in project vespa by vespa-engine.
the class OptimizePredicateExpression method doExecute.
@Override
protected void doExecute(ExecutionContext ctx) {
PredicateFieldValue predicate = ((PredicateFieldValue) ctx.getValue()).clone();
IntegerFieldValue arity = (IntegerFieldValue) ctx.getVariable("arity");
LongFieldValue lower_bound = (LongFieldValue) ctx.getVariable("lower_bound");
LongFieldValue upper_bound = (LongFieldValue) ctx.getVariable("upper_bound");
Long lower = lower_bound != null ? lower_bound.getLong() : null;
Long upper = upper_bound != null ? upper_bound.getLong() : null;
PredicateOptions options = new PredicateOptions(arity.getInteger(), lower, upper);
predicate.setPredicate(optimizer.process(predicate.getPredicate(), options));
ctx.setValue(predicate);
}
Aggregations