You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ra...@apache.org on 2016/01/13 18:48:06 UTC
[2/3] phoenix git commit: PHOENIX-2433 - support additional time
units - addendum
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/cc93168c
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cc93168c
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cc93168c
Branch: refs/heads/4.x-HBase-1.0
Commit: cc93168c62b7b3d5ea35ab8ff0535df9940cd008
Parents: 333d196
Author: ravimagham <ra...@bazaarvoice.com>
Authored: Wed Jan 13 09:22:00 2016 -0800
Committer: ravimagham <ra...@bazaarvoice.com>
Committed: Wed Jan 13 09:22:00 2016 -0800
----------------------------------------------------------------------
.../expression/function/RoundDateExpression.java | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc93168c/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..132bb51 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