Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 3f50a14e9 -> 92a1bd5fe
  refs/heads/4.x-HBase-1.0 333d196e3 -> cc93168c6
  refs/heads/master b4641f2cf -> 298a8a111


PHOENIX-2433 - support additional time units - addendum


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/92a1bd5f
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/92a1bd5f
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/92a1bd5f

Branch: refs/heads/4.x-HBase-0.98
Commit: 92a1bd5fe8d813a8baa2633e6328f9e02cd8ab36
Parents: 3f50a14
Author: ravimagham <[email protected]>
Authored: Wed Jan 13 09:20:27 2016 -0800
Committer: ravimagham <[email protected]>
Committed: Wed Jan 13 09:20:27 2016 -0800

----------------------------------------------------------------------
 .../expression/function/RoundDateExpression.java        | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/92a1bd5f/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDateExpression.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDateExpression.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDateExpression.java
index b0b4f99..af4f422 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDateExpression.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDateExpression.java
@@ -58,7 +58,6 @@ import com.google.common.collect.Lists;
 public class RoundDateExpression extends ScalarFunction {
     
     long divBy;
-    protected TimeUnit timeUnit;
     
     public static final String NAME = "ROUND";
     
@@ -126,7 +125,7 @@ public class RoundDateExpression extends ScalarFunction {
         Object timeUnitValue = ((LiteralExpression)children.get(1)).getValue();
         Object multiplierValue = numChildren > 2 ? 
((LiteralExpression)children.get(2)).getValue() : null;
         int multiplier = multiplierValue == null ? 1 
:((Number)multiplierValue).intValue();
-        timeUnit = TimeUnit.getTimeUnit(timeUnitValue != null ? 
timeUnitValue.toString() : null);
+        TimeUnit timeUnit = TimeUnit.getTimeUnit(timeUnitValue != null ? 
timeUnitValue.toString() : null);
         if(timeUnit.ordinal() < TIME_UNIT_MS.length) {
             divBy = multiplier * TIME_UNIT_MS[timeUnit.ordinal()];
         }
@@ -189,19 +188,12 @@ public class RoundDateExpression extends ScalarFunction {
     public void readFields(DataInput input) throws IOException {
         super.readFields(input);
         divBy = WritableUtils.readVLong(input);
-        if(divBy < 0) {
-            divBy = -(divBy + 1);
-            String tunit = WritableUtils.readString(input);
-            timeUnit = TimeUnit.valueOf(tunit);  
-        }
      }
 
     @Override
     public void write(DataOutput output) throws IOException {
         super.write(output);
-        // Negating the divBy is done to avoid breaking backward 
compatibility. refer PHOENIX-2433.
-        WritableUtils.writeVLong(output, -(divBy + 1));
-        WritableUtils.writeString(output, timeUnit.name());
+        WritableUtils.writeVLong(output, divBy);
     }
     
     @Override

Reply via email to