use of org.apache.druid.math.expr.Expr in project druid by druid-io.
the class IPv4AddressStringifyExprMacroTest method testInvalidLongArgTooSmall.
@Test
public void testInvalidLongArgTooSmall() {
Expr tooSmall = ExprEval.ofLong(-1L).toExpr();
Assert.assertNull(eval(tooSmall));
}
use of org.apache.druid.math.expr.Expr in project druid by druid-io.
the class TimestampShiftMacroTest method testPeriodYearAndTimeZone.
@Test
public void testPeriodYearAndTimeZone() {
Expr expr = apply(ImmutableList.of(ExprEval.of(timestamp.getMillis()).toExpr(), ExprEval.of("P1Y").toExpr(), ExprEval.of(1).toExpr(), ExprEval.of("America/Los_Angeles").toExpr()));
Assert.assertEquals(timestamp.toDateTime(DateTimes.inferTzFromString("America/Los_Angeles")).withPeriodAdded(Years.ONE, 1).getMillis(), expr.eval(InputBindings.nilBindings()).asLong());
}
use of org.apache.druid.math.expr.Expr in project druid by druid-io.
the class TimestampShiftMacroTest method testZeroStep.
@Test
public void testZeroStep() {
int step = 0;
Expr expr = apply(ImmutableList.of(ExprEval.of(timestamp.getMillis()).toExpr(), ExprEval.of("P1M").toExpr(), ExprEval.of(step).toExpr()));
Assert.assertEquals(timestamp.withPeriodAdded(Months.ONE, step).getMillis(), expr.eval(InputBindings.nilBindings()).asLong());
}
use of org.apache.druid.math.expr.Expr in project druid by druid-io.
the class IPv4AddressParseExprMacroTest method testValidLongArgLowest.
@Test
public void testValidLongArgLowest() {
long lowest = 0L;
Expr tooLow = ExprEval.ofLong(lowest).toExpr();
Assert.assertEquals(lowest, eval(tooLow));
}
use of org.apache.druid.math.expr.Expr in project druid by druid-io.
the class IPv4AddressParseExprMacroTest method testInvalidStringArgNotIPAddress.
@Test
public void testInvalidStringArgNotIPAddress() {
Expr notIpAddress = ExprEval.of("druid.apache.org").toExpr();
Assert.assertEquals(NULL, eval(notIpAddress));
}
Aggregations