This is for CEIL, not ROUND. Plus for round(timestamp,
anything-other-than-millis) we don't use RoundTimestampExpression.


On Fri, Dec 13, 2013 at 12:15 PM, Samarth Jain <notifications@github.com>wrote:

> In
> src/main/java/com/salesforce/phoenix/expression/function/CeilTimestampExpression.java:
>
> >      }
> >
> >      @Override
> >      public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
> > -        Expression child =  getChild();
> > -        if (child.evaluate(tuple, ptr)) {
> > -            PDataType childType = child.getDataType();
> > -            childType.coerceBytes(ptr, childType, child.getColumnModifier(), null);
> > -            BigDecimal value = (BigDecimal) childType.toObject(ptr);
> > -            value = value.round(getMathContext());
> > -            byte[] b = childType.toBytes(value, child.getColumnModifier());
> > -            ptr.set(b);
> > +        if (children.get(0).evaluate(tuple, ptr)) {
>
> We allow round(timestamp, day, 1). In such cases, we just fall back on
> what RoundDateExpression is doing. I have added a test for the same in
> RoundFloorCeilFunctionsTest.testRoundingUpTimestamp.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/forcedotcom/phoenix/pull/623/files#r8343751>
> .
>