Apache-Phoenix | Master | Hadoop1 | Build Successful

2014-08-27 Thread Apache Jenkins Server
Master branch build status Successful
Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git

Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-master-hadoop1/lastSuccessfulBuild/artifact/

Last Complete Test Report https://builds.apache.org/job/Phoenix-master-hadoop1/lastCompletedBuild/testReport/

Changes
[jtaylor] PHOENIX-761 Implement getKeyPart for round/ceil/floor of a DECIMAL value (Kyle Buzsaki)



Apache-Phoenix | 3.0 | Hadoop1 | Build Successful

2014-08-27 Thread Apache Jenkins Server
3.0 branch build status Successful
Source repository https://git-wip-us.apache.org/repos/asf/phoenix.git

Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastSuccessfulBuild/artifact/

Last Complete Test Report https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastCompletedBuild/testReport/

Changes
[jtaylor] PHOENIX-761 Implement getKeyPart for round/ceil/floor of a DECIMAL value (Kyle Buzsaki)



Jenkins build is back to normal : Phoenix | 4.0 | Hadoop2 #69

2014-08-27 Thread Apache Jenkins Server
See https://builds.apache.org/job/Phoenix-4.0-hadoop2/69/changes



svn commit: r1620952 - in /phoenix/site: publish/multi-tenancy.html source/src/site/markdown/multi-tenancy.md

2014-08-27 Thread elilevine
Author: elilevine
Date: Wed Aug 27 18:26:23 2014
New Revision: 1620952

URL: http://svn.apache.org/r1620952
Log:
Update multi-tenancy docs for PHOENIX-1204

Modified:
phoenix/site/publish/multi-tenancy.html
phoenix/site/source/src/site/markdown/multi-tenancy.md

Modified: phoenix/site/publish/multi-tenancy.html
URL: 
http://svn.apache.org/viewvc/phoenix/site/publish/multi-tenancy.html?rev=1620952r1=1620951r2=1620952view=diff
==
--- phoenix/site/publish/multi-tenancy.html (original)
+++ phoenix/site/publish/multi-tenancy.html Wed Aug 27 18:26:23 2014
@@ -1,7 +1,7 @@
 
 !DOCTYPE html
 !--
- Generated by Apache Maven Doxia at 2014-08-18
+ Generated by Apache Maven Doxia at 2014-08-26
  Rendered using Reflow Maven Skin 1.1.0 
(http://andriusvelykis.github.io/reflow-maven-skin)
 --
 html  xml:lang=en lang=en
@@ -124,30 +124,34 @@
 div class=page-header
  h1Multi tenancy/h1
 /div 
-pSupport for multi-tenancy is built on top of the concepts of a a 
href=views.htmlVIEW/a in Phoenix. Users create a logical tenant-specific 
table as a VIEW and query and update it just like with regular Phoenix tables. 
Data in these tenant-specific tables resides in a shared, regular Phoenix table 
(and thus in a shared HBase table) that is declared at table creation time to 
support multi-tenancy. All tenant-specific Phoenix tables whose data resides in 
the same physical HBase table have the same primary key structure but each 
tenant’s table can contain any number of non-PK columns unique to it. The 
main advantages afforded by this feature are:/p 
-ol style=list-style-type: decimal 
- liIt implements physical tenant data isolation, including automatically 
constraining tenants to only work with data that “belongs” to the each 
tenant./li 
- liIt prevents a proliferation of HBase tables, minimizing operational 
complexity./li 
-/ol 
 div class=section 
  div class=section 
+  h3 id=HighlightsHighlights/h3 
+  ul 
+   liMulti-tenancy in Phoenix works via a combination of multi-tenant tables 
and tenant-specific connections (detailed below)./li 
+   liTenants open tenant-specific connections to Phoenix. These connections 
can only access data that belongs to the tenant./li 
+   liTenants only see their own data in multi-tenant tables and can see all 
data in regular tables./li 
+   liIn order to add their own columns, tenants create tanant-specific views 
on top of multi-tenant tables and add their own columns to the views./li 
+  /ul 
+ /div 
+ div class=section 
   h3 id=Multi-tenant_tablesMulti-tenant tables/h3 
-  pThe first primary key column of the physical multi-tenant table must be 
used to identify the tenant. For example:/p 
+  pMulti-tenant tables in Phoenix are regular tables that are declared using 
the MULTI_TENANT=true DDL property. They work in conjuntion with 
tenant-specific connections (detailed below) to ensure that tenats only see 
their data in such tables. The first primary key column of multi-tenant tables 
identifies the tenant. For example:/p 
   div class=source 
preCREATE TABLE base.event (tenant_id VARCHAR, event_type CHAR(1), 
created_date DATE, event_id BIGINT)
 MULTI_TENANT=true;
 /pre 
   /div 
-  pIn this case, the tenant_id column identifies the tenant and the table is 
declared to be multi-tenant. The column that identifies the tenant may be given 
any name, but must of type VARCHAR or CHAR./p 
+  pThe column that identifies the tenant may be given any name, but must of 
type VARCHAR or CHAR. Regular Phoenix connections work with such tables with no 
constraints, including working with data across tenant boundaries./p 
  /div 
  div class=section 
-  h3 id=Tenant-specific_TablesTenant-specific Tables/h3 
-  pTenants are identified by the presence or absence of a TenantId property 
at JDBC connection-time. A connection with a non-null TenantId is considered a 
tenant-specific connection. A connection with an unspecified or null TenantId 
is a regular connection. A tenant specific connection may only query:/p 
+  h3 id=Tenant-specific_ConnectionsTenant-specific Connections/h3 
+  pTenants are identified by the presence or absence of the TenantId 
property at JDBC connection-time. A connection with a non-null TenantId is 
considered a tenant-specific connection. A connection with an unspecified or 
null TenantId is a regular connection. A tenant-specific connection may only 
query:/p 
   ul 
-   libtheir own schema/b, which is to say it only sees tenant-specific 
views that were created by that tenant./li 
-   libnon multi-tenant global tables/b, that is tables created with a 
regular connection without the MULTI_TENANT=TRUE declaration./li 
+   liball data in non-multi-tenant (global) tables/b, that is tables 
created with a regular connection without the MULTI_TENANT=true 
declaration./li 
+   libtheir own data in multi-tenant tables/b./li 
+   libtheir own schema/b, which is to say it only sees 

git commit: PHOENIX-1206 Decimal serialization broken for negative numbers with more than 19 digits of precision (Kyle Buzsaki)

2014-08-27 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master 29c610cfd - e8c2664e7


PHOENIX-1206 Decimal serialization broken for negative numbers with more than 
19 digits of precision (Kyle Buzsaki)


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

Branch: refs/heads/master
Commit: e8c2664e7705901991114278d182b65c2fb57c00
Parents: 29c610c
Author: James Taylor jamestay...@apache.org
Authored: Wed Aug 27 18:18:12 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Wed Aug 27 18:18:12 2014 -0700

--
 .../org/apache/phoenix/schema/PDataType.java|  4 +--
 .../org/apache/phoenix/util/NumberUtil.java |  2 +-
 .../RoundFloorCeilExpressionsTest.java  | 31 
 .../apache/phoenix/schema/PDataTypeTest.java| 22 ++
 4 files changed, 43 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e8c2664e/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
index 714028c..3d38d64 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
@@ -6596,7 +6596,7 @@ public enum PDataType {
 } else {
 // Adjust length and offset down because we don't have enough 
room
 length = MAX_BIG_DECIMAL_BYTES;
-index = offset + length - 1;
+index = offset + length;
 }
 }
 BigInteger bi = v.unscaledValue();
@@ -6605,7 +6605,7 @@ public enum PDataType {
 BigInteger[] dandr = bi.divideAndRemainder(divideBy);
 bi = dandr[0];
 int digit = dandr[1].intValue();
-result[--index] = (byte)(signum * digit * multiplyBy + 
digitOffset);
+result[--index] = (byte)(digit * multiplyBy + digitOffset);
 multiplyBy = 1;
 divideBy = ONE_HUNDRED;
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e8c2664e/phoenix-core/src/main/java/org/apache/phoenix/util/NumberUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/NumberUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/NumberUtil.java
index 1943b6b..7889a89 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/NumberUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/NumberUtil.java
@@ -37,7 +37,7 @@ public class NumberUtil {
  * @return new {@link BigDecimal} instance
  */
 public static BigDecimal normalize(BigDecimal bigDecimal) {
-return 
bigDecimal.stripTrailingZeros().round(PDataType.DEFAULT_MATH_CONTEXT);
+return 
bigDecimal.round(PDataType.DEFAULT_MATH_CONTEXT).stripTrailingZeros();
 }
 
 public static BigDecimal setDecimalWidthAndScale(BigDecimal decimal, 
Integer precisionOrNull, Integer scaleOrNull) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e8c2664e/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 25520c4..4757e5b 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
@@ -327,19 +327,24 @@ public class RoundFloorCeilExpressionsTest {
 // value doesn't matter because we only use those expressions to produce a 
keypart
 private static final LiteralExpression DUMMY_DECIMAL = 
LiteralExpression.newConstant(new BigDecimal(2.5));
 
-// this should be PDataType#MAX_PRECISION (38)
-// but there are rounding errors in DECIMAL.toBytes() and 
DECIMAL.toObject()
-// with precisions of 20 or greater. See 
https://issues.apache.org/jira/browse/PHOENIX-1206
-private static final int MAX_RELIABLE_PRECISION = 18;
-
-// once PHOENIX-1206 is fixed, we should add more precise decimals to 
these tests
 private static final ListBigDecimal DECIMALS = 
Collections.unmodifiableList(
 Arrays.asList(
-new BigDecimal(-200300), new BigDecimal(-8.44), new 

git commit: PHOENIX-1206 Decimal serialization broken for negative numbers with more than 19 digits of precision (Kyle Buzsaki)

2014-08-27 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/3.0 c58532283 - 3f853bd71


PHOENIX-1206 Decimal serialization broken for negative numbers with more than 
19 digits of precision (Kyle Buzsaki)


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

Branch: refs/heads/3.0
Commit: 3f853bd7129c01955e3083aeafefc372431672a2
Parents: c585322
Author: James Taylor jamestay...@apache.org
Authored: Wed Aug 27 18:23:17 2014 -0700
Committer: James Taylor jamestay...@apache.org
Committed: Wed Aug 27 18:23:17 2014 -0700

--
 .../org/apache/phoenix/schema/PDataType.java|  4 +--
 .../org/apache/phoenix/util/NumberUtil.java |  2 +-
 .../RoundFloorCeilExpressionsTest.java  | 31 
 .../apache/phoenix/schema/PDataTypeTest.java| 22 ++
 4 files changed, 43 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f853bd7/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
index 714028c..3d38d64 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
@@ -6596,7 +6596,7 @@ public enum PDataType {
 } else {
 // Adjust length and offset down because we don't have enough 
room
 length = MAX_BIG_DECIMAL_BYTES;
-index = offset + length - 1;
+index = offset + length;
 }
 }
 BigInteger bi = v.unscaledValue();
@@ -6605,7 +6605,7 @@ public enum PDataType {
 BigInteger[] dandr = bi.divideAndRemainder(divideBy);
 bi = dandr[0];
 int digit = dandr[1].intValue();
-result[--index] = (byte)(signum * digit * multiplyBy + 
digitOffset);
+result[--index] = (byte)(digit * multiplyBy + digitOffset);
 multiplyBy = 1;
 divideBy = ONE_HUNDRED;
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f853bd7/phoenix-core/src/main/java/org/apache/phoenix/util/NumberUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/NumberUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/NumberUtil.java
index 1943b6b..7889a89 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/NumberUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/NumberUtil.java
@@ -37,7 +37,7 @@ public class NumberUtil {
  * @return new {@link BigDecimal} instance
  */
 public static BigDecimal normalize(BigDecimal bigDecimal) {
-return 
bigDecimal.stripTrailingZeros().round(PDataType.DEFAULT_MATH_CONTEXT);
+return 
bigDecimal.round(PDataType.DEFAULT_MATH_CONTEXT).stripTrailingZeros();
 }
 
 public static BigDecimal setDecimalWidthAndScale(BigDecimal decimal, 
Integer precisionOrNull, Integer scaleOrNull) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f853bd7/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 25520c4..4757e5b 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
@@ -327,19 +327,24 @@ public class RoundFloorCeilExpressionsTest {
 // value doesn't matter because we only use those expressions to produce a 
keypart
 private static final LiteralExpression DUMMY_DECIMAL = 
LiteralExpression.newConstant(new BigDecimal(2.5));
 
-// this should be PDataType#MAX_PRECISION (38)
-// but there are rounding errors in DECIMAL.toBytes() and 
DECIMAL.toObject()
-// with precisions of 20 or greater. See 
https://issues.apache.org/jira/browse/PHOENIX-1206
-private static final int MAX_RELIABLE_PRECISION = 18;
-
-// once PHOENIX-1206 is fixed, we should add more precise decimals to 
these tests
 private static final ListBigDecimal DECIMALS = 
Collections.unmodifiableList(
 Arrays.asList(
-new BigDecimal(-200300), new BigDecimal(-8.44), new 

Apache-Phoenix | 4.0 | Hadoop1 | Build Successful

2014-08-27 Thread Apache Jenkins Server
4.0 branch build status Successful

Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git

Compiled Artifacts https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastSuccessfulBuild/artifact/

Test Report https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastCompletedBuild/testReport/

Changes
[jamestaylor] PHOENIX-1206 Decimal serialization broken for negative numbers with more than 19 digits of precision (Kyle Buzsaki)



Apache-Phoenix | 3.0 | Hadoop1 | Build Successful

2014-08-27 Thread Apache Jenkins Server
3.0 branch build status Successful
Source repository https://git-wip-us.apache.org/repos/asf/phoenix.git

Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastSuccessfulBuild/artifact/

Last Complete Test Report https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastCompletedBuild/testReport/

Changes
[jamestaylor] PHOENIX-1206 Decimal serialization broken for negative numbers with more than 19 digits of precision (Kyle Buzsaki)



git commit: Modify test so as to not introduce a Java 1.7 dependency

2014-08-27 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master e8c2664e7 - bd174c1c9


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/bd174c1c
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bd174c1c
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bd174c1c

Branch: refs/heads/master
Commit: bd174c1c936398ad2b4b4c59d5ab6a9289c37afe
Parents: e8c2664
Author: James Taylor jtay...@salesforce.com
Authored: Wed Aug 27 22:49:31 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Wed Aug 27 22:52:04 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bd174c1c/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);
 }
 }
 }