phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject git commit: Modify test so as to not introduce a Java 1.7 dependency
Date Thu, 28 Aug 2014 05:50:52 GMT
Repository: phoenix
Updated Branches:
  refs/heads/3.0 3f853bd71 -> e1ba4dec4


Modify test so as to not introduce a Java 1.7 dependency


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

Branch: refs/heads/3.0
Commit: e1ba4dec494940dbd108f4a2c358f467b0156cd8
Parents: 3f853bd
Author: James Taylor <jtaylor@salesforce.com>
Authored: Wed Aug 27 22:49:31 2014 -0700
Committer: James Taylor <jtaylor@salesforce.com>
Committed: Wed Aug 27 22:53:12 2014 -0700

----------------------------------------------------------------------
 .../RoundFloorCeilExpressionsTest.java          | 35 +++++++++-----------
 1 file changed, 15 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e1ba4dec/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java
index 4757e5b..f8a7391 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/expression/RoundFloorCeilExpressionsTest.java
@@ -17,19 +17,21 @@
  */
 package org.apache.phoenix.expression;
 
-import java.math.BigDecimal;
+import static org.apache.phoenix.schema.PDataType.DECIMAL;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.math.BigDecimal;
 import java.sql.Date;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
 
+import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.phoenix.compile.KeyPart;
 import org.apache.phoenix.expression.function.CeilDateExpression;
@@ -44,9 +46,7 @@ import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.schema.IllegalDataException;
 import org.apache.phoenix.schema.PDataType;
-import static org.apache.phoenix.schema.PDataType.DECIMAL;
 import org.apache.phoenix.util.DateUtil;
-import static org.junit.Assert.assertFalse;
 import org.junit.Test;
 
 /**
@@ -233,22 +233,17 @@ public class RoundFloorCeilExpressionsTest {
          * @param scale  the scale to round the decimal to
          * @return  the expression containing the above parameters
          */
-        public Expression getExpression(byte[] key, int scale) {
-            try {
-                LiteralExpression decimalLiteral = LiteralExpression.newConstant(DECIMAL.toObject(key),
DECIMAL);
-                switch(this) {
-                    case ROUND:
-                        return RoundDecimalExpression.create(decimalLiteral, scale);
-                    case FLOOR:
-                        return FloorDecimalExpression.create(decimalLiteral, scale);
-                    case CEIL:
-                        return CeilDecimalExpression.create(decimalLiteral, scale);
-                    default:
-                        throw new AssertionError("Unknown RoundingType");
-                }
-            }
-            catch (SQLException ex) {
-                throw new AssertionError("Should never happen when creating decimal literal",
ex);
+        public Expression getExpression(byte[] key, int scale) throws SQLException {
+            LiteralExpression decimalLiteral = LiteralExpression.newConstant(DECIMAL.toObject(key),
DECIMAL);
+            switch(this) {
+                case ROUND:
+                    return RoundDecimalExpression.create(decimalLiteral, scale);
+                case FLOOR:
+                    return FloorDecimalExpression.create(decimalLiteral, scale);
+                case CEIL:
+                    return CeilDecimalExpression.create(decimalLiteral, scale);
+                default:
+                    throw new AssertionError("Unknown RoundingType");
             }
         }
     }


Mime
View raw message