git commit: PHOENIX-1366 ORDINAL_POSITION incorrect for multi-tenant table over tenant-specific connection (Bruno Dumon)
Repository: phoenix Updated Branches: refs/heads/4.0 4753c4efe - 553fb4b33 PHOENIX-1366 ORDINAL_POSITION incorrect for multi-tenant table over tenant-specific connection (Bruno Dumon) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/553fb4b3 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/553fb4b3 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/553fb4b3 Branch: refs/heads/4.0 Commit: 553fb4b33541531045435ed18e8ed5798edd6017 Parents: 4753c4e Author: James Taylor jtay...@salesforce.com Authored: Sun Oct 26 20:46:03 2014 -0700 Committer: James Taylor jtay...@salesforce.com Committed: Sun Oct 26 20:46:03 2014 -0700 -- .../end2end/TenantSpecificTablesDDLIT.java | 23 ++- .../phoenix/jdbc/PhoenixDatabaseMetaData.java | 31 2 files changed, 42 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/553fb4b3/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java index 589e963..42fe5b8 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java @@ -22,6 +22,8 @@ import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_DROP_PK; import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_MODIFY_VIEW_PK; import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_MUTATE_TABLE; import static org.apache.phoenix.exception.SQLExceptionCode.TABLE_UNDEFINED; +import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.KEY_SEQ; +import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ORDINAL_POSITION; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TYPE_SEQUENCE; @@ -554,21 +556,22 @@ public class TenantSpecificTablesDDLIT extends BaseTenantSpecificTablesIT { // make sure tenants see parent table's columns and their own rs = meta.getColumns(null, null, StringUtil.escapeLike(TENANT_TABLE_NAME) + %, null); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, user); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, user, 1); assertTrue(rs.next()); // (tenant_id column is not visible in tenant-specific connection) -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_type_id); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_type_id, 2); +assertEquals(1, rs.getInt(KEY_SEQ)); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, id); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, id, 3); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_col); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_col, 4); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, user); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, user, 1); assertTrue(rs.next()); // (tenant_id column is not visible in tenant-specific connection) -assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, id); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, id, 2); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, tenant_col); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, tenant_col, 3); assertFalse(rs.next()); } finally { @@ -587,4 +590,10 @@ public class TenantSpecificTablesDDLIT extends BaseTenantSpecificTablesIT { assertEquals(table, rs.getString(TABLE_NAME)); assertEquals(SchemaUtil.normalizeIdentifier(column), rs.getString(COLUMN_NAME)); } + +private void assertColumnMetaData(ResultSet rs, String schema, String table, String column, int ordinalPosition) +throws SQLException { +assertColumnMetaData(rs, schema, table, column); +assertEquals(ordinalPosition, rs.getInt(ORDINAL_POSITION)); +} } \ No newline at end of file
git commit: PHOENIX-1366 ORDINAL_POSITION incorrect for multi-tenant table over tenant-specific connection (Bruno Dumon)
Repository: phoenix Updated Branches: refs/heads/master 06a511cff - 53c1fd788 PHOENIX-1366 ORDINAL_POSITION incorrect for multi-tenant table over tenant-specific connection (Bruno Dumon) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/53c1fd78 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/53c1fd78 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/53c1fd78 Branch: refs/heads/master Commit: 53c1fd7884a5eeaecf882cb199f7a25acb2d8212 Parents: 06a511c Author: James Taylor jtay...@salesforce.com Authored: Sun Oct 26 20:46:03 2014 -0700 Committer: James Taylor jtay...@salesforce.com Committed: Sun Oct 26 20:47:31 2014 -0700 -- .../end2end/TenantSpecificTablesDDLIT.java | 23 ++- .../phoenix/jdbc/PhoenixDatabaseMetaData.java | 31 2 files changed, 42 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/53c1fd78/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java index 589e963..42fe5b8 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java @@ -22,6 +22,8 @@ import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_DROP_PK; import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_MODIFY_VIEW_PK; import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_MUTATE_TABLE; import static org.apache.phoenix.exception.SQLExceptionCode.TABLE_UNDEFINED; +import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.KEY_SEQ; +import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ORDINAL_POSITION; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TYPE_SEQUENCE; @@ -554,21 +556,22 @@ public class TenantSpecificTablesDDLIT extends BaseTenantSpecificTablesIT { // make sure tenants see parent table's columns and their own rs = meta.getColumns(null, null, StringUtil.escapeLike(TENANT_TABLE_NAME) + %, null); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, user); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, user, 1); assertTrue(rs.next()); // (tenant_id column is not visible in tenant-specific connection) -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_type_id); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_type_id, 2); +assertEquals(1, rs.getInt(KEY_SEQ)); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, id); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, id, 3); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_col); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_col, 4); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, user); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, user, 1); assertTrue(rs.next()); // (tenant_id column is not visible in tenant-specific connection) -assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, id); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, id, 2); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, tenant_col); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, tenant_col, 3); assertFalse(rs.next()); } finally { @@ -587,4 +590,10 @@ public class TenantSpecificTablesDDLIT extends BaseTenantSpecificTablesIT { assertEquals(table, rs.getString(TABLE_NAME)); assertEquals(SchemaUtil.normalizeIdentifier(column), rs.getString(COLUMN_NAME)); } + +private void assertColumnMetaData(ResultSet rs, String schema, String table, String column, int ordinalPosition) +throws SQLException { +assertColumnMetaData(rs, schema, table, column); +assertEquals(ordinalPosition, rs.getInt(ORDINAL_POSITION)); +} } \ No newline at end of file
git commit: PHOENIX-1382: Phoenix 4.2 RC Issue
Repository: phoenix Updated Branches: refs/heads/4.0 553fb4b33 - 00522cfd3 PHOENIX-1382: Phoenix 4.2 RC Issue Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/00522cfd Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/00522cfd Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/00522cfd Branch: refs/heads/4.0 Commit: 00522cfd3fee98336be442ae9c4696a8c657ddc2 Parents: 553fb4b Author: Jeffrey Zhong jeffr...@apache.org Authored: Sun Oct 26 22:07:13 2014 -0700 Committer: Jeffrey Zhong jeffr...@apache.org Committed: Sun Oct 26 22:07:13 2014 -0700 -- bin/phoenix_utils.py | 2 +- .../main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/00522cfd/bin/phoenix_utils.py -- diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py index 4f7d9c3..2331ae9 100755 --- a/bin/phoenix_utils.py +++ b/bin/phoenix_utils.py @@ -49,7 +49,7 @@ def findFileInPathWithoutRecursion(pattern, path): return def setPath(): - PHOENIX_CLIENT_JAR_PATTERN = phoenix-*-client*.jar + PHOENIX_CLIENT_JAR_PATTERN = phoenix-*-client.jar PHOENIX_TESTS_JAR_PATTERN = phoenix-*-tests*.jar global current_dir current_dir = os.path.dirname(os.path.abspath(__file__)) http://git-wip-us.apache.org/repos/asf/phoenix/blob/00522cfd/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java index ac1287a..662bed3 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java @@ -52,7 +52,7 @@ import com.google.protobuf.HBaseZeroCopyByteString; */ public abstract class MetaDataProtocol extends MetaDataService { public static final int PHOENIX_MAJOR_VERSION = 4; -public static final int PHOENIX_MINOR_VERSION = 1; +public static final int PHOENIX_MINOR_VERSION = 2; public static final int PHOENIX_PATCH_NUMBER = 0; public static final int PHOENIX_VERSION = VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
[2/2] git commit: PHOENIX-1366 Use static constants
PHOENIX-1366 Use static constants Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0d90e2fc Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0d90e2fc Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0d90e2fc Branch: refs/heads/3.0 Commit: 0d90e2fc92e6013a48d6479fc8208733edab9d52 Parents: 60fee11 Author: James Taylor jtay...@salesforce.com Authored: Sun Oct 26 22:13:31 2014 -0700 Committer: James Taylor jtay...@salesforce.com Committed: Sun Oct 26 22:13:31 2014 -0700 -- .../phoenix/jdbc/PhoenixDatabaseMetaData.java | 32 +++- 1 file changed, 18 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/0d90e2fc/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java index 0cf34dc..5560d48 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java @@ -29,7 +29,6 @@ import java.util.Collections; import java.util.List; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.Bytes; @@ -257,6 +256,9 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho public static final String PARENT_TENANT_ID = PARENT_TENANT_ID; public static final byte[] PARENT_TENANT_ID_BYTES = Bytes.toBytes(PARENT_TENANT_ID); +private static final String TENANT_POS_SHIFT = TENANT_POS_SHIFT; +private static final byte[] TENANT_POS_SHIFT_BYTES = Bytes.toBytes(TENANT_POS_SHIFT); + private final PhoenixConnection connection; private final ResultSet emptyResultSet; @@ -403,7 +405,7 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho SQL_DATA_TYPE + , + SQL_DATETIME_SUB + , + CHAR_OCTET_LENGTH + , + -CASE WHEN TENANT_POS_SHIFT THEN ORDINAL_POSITION-1 ELSE ORDINAL_POSITION END AS + ORDINAL_POSITION + , + +CASE WHEN + TENANT_POS_SHIFT + THEN + ORDINAL_POSITION + -1 ELSE + ORDINAL_POSITION + END AS + ORDINAL_POSITION + , + CASE + NULLABLE + WHEN + DatabaseMetaData.attributeNoNulls + THEN ' + Boolean.FALSE.toString() + ' WHEN + DatabaseMetaData.attributeNullable + THEN ' + Boolean.TRUE.toString() + ' END AS + IS_NULLABLE + , + SCOPE_CATALOG + , + SCOPE_SCHEMA + , + @@ -415,8 +417,8 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho DATA_TYPE + + TYPE_ID + , +// raw type id for potential internal consumption VIEW_CONSTANT + , + MULTI_TENANT + , + -CASE WHEN TENANT_POS_SHIFT THEN KEY_SEQ-1 ELSE KEY_SEQ END AS + KEY_SEQ + - from + SYSTEM_CATALOG + + SYSTEM_CATALOG_ALIAS + (TENANT_POS_SHIFT BOOLEAN)); +CASE WHEN + TENANT_POS_SHIFT + THEN + KEY_SEQ + -1 ELSE + KEY_SEQ + END AS + KEY_SEQ + + from + SYSTEM_CATALOG + + SYSTEM_CATALOG_ALIAS + ( + TENANT_POS_SHIFT + BOOLEAN)); StringBuilder where = new StringBuilder(); addTenantIdFilter(where, catalog); if (schemaPattern != null) { @@ -521,23 +523,25 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho tuple = super.next(); } -if (tuple != null inMultiTenantTable !tenantColumnSkipped - new Long(1L).equals(getColumn(tuple, keySeqIndex))) { -tenantColumnSkipped = true; -// skip tenant id primary key column -return next(); +if (tuple != null inMultiTenantTable !tenantColumnSkipped) { +Object value = getColumn(tuple, keySeqIndex); +if (value != null ((Number)value).longValue() == 1L) { +tenantColumnSkipped = true; +// skip tenant id primary key column +return next(); +} } if (tuple != null tenantColumnSkipped) { ResultTuple resultTuple = (ResultTuple)tuple; -ListCell cells = resultTuple.getResult().listCells(); -KeyValue kv = new KeyValue(resultTuple.getResult().getRow(),
[1/2] git commit: PHOENIX-1366 ORDINAL_POSITION incorrect for multi-tenant table over tenant-specific connection (Bruno Dumon)
Repository: phoenix Updated Branches: refs/heads/3.0 2bdc33bc5 - 0d90e2fc9 PHOENIX-1366 ORDINAL_POSITION incorrect for multi-tenant table over tenant-specific connection (Bruno Dumon) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/60fee11b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/60fee11b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/60fee11b Branch: refs/heads/3.0 Commit: 60fee11be5e9968d7922215c24aaeb29cdaf416b Parents: 2bdc33b Author: James Taylor jtay...@salesforce.com Authored: Sun Oct 26 20:46:03 2014 -0700 Committer: James Taylor jtay...@salesforce.com Committed: Sun Oct 26 20:51:21 2014 -0700 -- .../end2end/TenantSpecificTablesDDLIT.java | 23 ++- .../phoenix/jdbc/PhoenixDatabaseMetaData.java | 31 2 files changed, 42 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/60fee11b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java index 589e963..42fe5b8 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java @@ -22,6 +22,8 @@ import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_DROP_PK; import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_MODIFY_VIEW_PK; import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_MUTATE_TABLE; import static org.apache.phoenix.exception.SQLExceptionCode.TABLE_UNDEFINED; +import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.KEY_SEQ; +import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ORDINAL_POSITION; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE; import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TYPE_SEQUENCE; @@ -554,21 +556,22 @@ public class TenantSpecificTablesDDLIT extends BaseTenantSpecificTablesIT { // make sure tenants see parent table's columns and their own rs = meta.getColumns(null, null, StringUtil.escapeLike(TENANT_TABLE_NAME) + %, null); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, user); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, user, 1); assertTrue(rs.next()); // (tenant_id column is not visible in tenant-specific connection) -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_type_id); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_type_id, 2); +assertEquals(1, rs.getInt(KEY_SEQ)); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, id); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, id, 3); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_col); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME, tenant_col, 4); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, user); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, user, 1); assertTrue(rs.next()); // (tenant_id column is not visible in tenant-specific connection) -assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, id); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, id, 2); assertTrue(rs.next()); -assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, tenant_col); +assertColumnMetaData(rs, null, TENANT_TABLE_NAME_NO_TENANT_TYPE_ID, tenant_col, 3); assertFalse(rs.next()); } finally { @@ -587,4 +590,10 @@ public class TenantSpecificTablesDDLIT extends BaseTenantSpecificTablesIT { assertEquals(table, rs.getString(TABLE_NAME)); assertEquals(SchemaUtil.normalizeIdentifier(column), rs.getString(COLUMN_NAME)); } + +private void assertColumnMetaData(ResultSet rs, String schema, String table, String column, int ordinalPosition) +throws SQLException { +assertColumnMetaData(rs, schema, table, column); +assertEquals(ordinalPosition, rs.getInt(ORDINAL_POSITION)); +} } \ No newline at end of file
Apache-Phoenix | 4.0 | Build Successful
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/lastSuccessfulBuild/artifact/ Test Report https://builds.apache.org/job/Phoenix-4.0/lastCompletedBuild/testReport/ Changes [jtaylor] PHOENIX-1366 ORDINAL_POSITION incorrect for multi-tenant table over tenant-specific connection (Bruno Dumon)
Jenkins build is back to normal : Phoenix | 4.0 #423
See https://builds.apache.org/job/Phoenix-4.0/423/changes
Apache-Phoenix | 3.0 | Hadoop1 | Build Successful
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-1366 ORDINAL_POSITION incorrect for multi-tenant table over tenant-specific connection (Bruno Dumon) [jtaylor] PHOENIX-1366 Use static constants
[3/4] git commit: PHOENIX-1379 Wrong MultiIndexWriteFailureException when recovering local index table (Shunsuke Nakamura)
PHOENIX-1379 Wrong MultiIndexWriteFailureException when recovering local index table (Shunsuke Nakamura) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/351769c6 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/351769c6 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/351769c6 Branch: refs/heads/4.0 Commit: 351769c69e1d857fda48c2e8aec851384fcafb0e Parents: 5093c2f Author: James Taylor jtay...@salesforce.com Authored: Sun Oct 26 22:26:41 2014 -0700 Committer: James Taylor jtay...@salesforce.com Committed: Sun Oct 26 22:26:41 2014 -0700 -- .../index/write/recovery/TrackingParallelWriterIndexCommitter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/351769c6/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java index 9a61191..9171b53 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java @@ -158,7 +158,7 @@ public class TrackingParallelWriterIndexCommitter implements IndexCommitter { if (indexRegion != null) { throwFailureIfDone(); indexRegion.batchMutate(mutations.toArray(new Mutation[mutations.size()])); -return null; +return Boolean.TRUE; } } } catch (IOException ignord) {
[2/4] git commit: PHOENIX-1366 Use static constants
PHOENIX-1366 Use static constants Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5093c2f2 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5093c2f2 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5093c2f2 Branch: refs/heads/4.0 Commit: 5093c2f262480d04f8495c55d23960b89a674c6e Parents: ba96d70 Author: James Taylor jtay...@salesforce.com Authored: Sun Oct 26 22:25:32 2014 -0700 Committer: James Taylor jtay...@salesforce.com Committed: Sun Oct 26 22:25:32 2014 -0700 -- .../java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5093c2f2/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java index a03cda4..8edc7ae 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java @@ -29,6 +29,7 @@ import java.util.Collections; import java.util.List; import org.apache.commons.lang.StringEscapeUtils; +import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.Bytes; @@ -536,14 +537,14 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho if (tuple != null tenantColumnSkipped) { ResultTuple resultTuple = (ResultTuple)tuple; -ListKeyValue cells = resultTuple.getResult().list(); +ListCell cells = resultTuple.getResult().listCells(); KeyValue kv = new KeyValue(resultTuple.getResult().getRow(), TABLE_FAMILY_BYTES, TENANT_POS_SHIFT_BYTES, PDataType.TRUE_BYTES); -ListKeyValue newCells = Lists.newArrayListWithCapacity(cells.size() + 1); +ListCell newCells = Lists.newArrayListWithCapacity(cells.size() + 1); newCells.addAll(cells); newCells.add(kv); Collections.sort(newCells, KeyValue.COMPARATOR); -resultTuple.setResult(new Result(newCells)); +resultTuple.setResult(Result.create(newCells)); } return tuple;
[3/3] git commit: PHOENIX-1379 Wrong MultiIndexWriteFailureException when recovering local index table (Shunsuke Nakamura)
PHOENIX-1379 Wrong MultiIndexWriteFailureException when recovering local index table (Shunsuke Nakamura) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/79423f80 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/79423f80 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/79423f80 Branch: refs/heads/master Commit: 79423f8011ef35ae5c8509d67e0935fff549e80b Parents: 1120629 Author: James Taylor jtay...@salesforce.com Authored: Sun Oct 26 22:26:41 2014 -0700 Committer: James Taylor jtay...@salesforce.com Committed: Sun Oct 26 22:40:03 2014 -0700 -- .../index/write/recovery/TrackingParallelWriterIndexCommitter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/79423f80/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java index 9a61191..9171b53 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java @@ -158,7 +158,7 @@ public class TrackingParallelWriterIndexCommitter implements IndexCommitter { if (indexRegion != null) { throwFailureIfDone(); indexRegion.batchMutate(mutations.toArray(new Mutation[mutations.size()])); -return null; +return Boolean.TRUE; } } } catch (IOException ignord) {
[1/3] git commit: PHOENIX-1366 Use static constants
Repository: phoenix Updated Branches: refs/heads/master 53c1fd788 - 79423f801 PHOENIX-1366 Use static constants Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3cbd85b0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3cbd85b0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3cbd85b0 Branch: refs/heads/master Commit: 3cbd85b0f1baaa953a3a29d69574fe543bfdc6a0 Parents: 53c1fd7 Author: James Taylor jtay...@salesforce.com Authored: Sun Oct 26 22:13:31 2014 -0700 Committer: James Taylor jtay...@salesforce.com Committed: Sun Oct 26 22:39:24 2014 -0700 -- .../phoenix/jdbc/PhoenixDatabaseMetaData.java | 32 +++- 1 file changed, 18 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/3cbd85b0/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java index ba77f6d..a03cda4 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java @@ -29,7 +29,6 @@ import java.util.Collections; import java.util.List; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.Bytes; @@ -259,6 +258,9 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho public static final String PARENT_TENANT_ID = PARENT_TENANT_ID; public static final byte[] PARENT_TENANT_ID_BYTES = Bytes.toBytes(PARENT_TENANT_ID); +private static final String TENANT_POS_SHIFT = TENANT_POS_SHIFT; +private static final byte[] TENANT_POS_SHIFT_BYTES = Bytes.toBytes(TENANT_POS_SHIFT); + private final PhoenixConnection connection; private final ResultSet emptyResultSet; @@ -405,7 +407,7 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho SQL_DATA_TYPE + , + SQL_DATETIME_SUB + , + CHAR_OCTET_LENGTH + , + -CASE WHEN TENANT_POS_SHIFT THEN ORDINAL_POSITION-1 ELSE ORDINAL_POSITION END AS + ORDINAL_POSITION + , + +CASE WHEN + TENANT_POS_SHIFT + THEN + ORDINAL_POSITION + -1 ELSE + ORDINAL_POSITION + END AS + ORDINAL_POSITION + , + CASE + NULLABLE + WHEN + DatabaseMetaData.attributeNoNulls + THEN ' + Boolean.FALSE.toString() + ' WHEN + DatabaseMetaData.attributeNullable + THEN ' + Boolean.TRUE.toString() + ' END AS + IS_NULLABLE + , + SCOPE_CATALOG + , + SCOPE_SCHEMA + , + @@ -417,8 +419,8 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho DATA_TYPE + + TYPE_ID + , +// raw type id for potential internal consumption VIEW_CONSTANT + , + MULTI_TENANT + , + -CASE WHEN TENANT_POS_SHIFT THEN KEY_SEQ-1 ELSE KEY_SEQ END AS + KEY_SEQ + - from + SYSTEM_CATALOG + + SYSTEM_CATALOG_ALIAS + (TENANT_POS_SHIFT BOOLEAN)); +CASE WHEN + TENANT_POS_SHIFT + THEN + KEY_SEQ + -1 ELSE + KEY_SEQ + END AS + KEY_SEQ + + from + SYSTEM_CATALOG + + SYSTEM_CATALOG_ALIAS + ( + TENANT_POS_SHIFT + BOOLEAN)); StringBuilder where = new StringBuilder(); addTenantIdFilter(where, catalog); if (schemaPattern != null) { @@ -523,23 +525,25 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho tuple = super.next(); } -if (tuple != null inMultiTenantTable !tenantColumnSkipped - new Long(1L).equals(getColumn(tuple, keySeqIndex))) { -tenantColumnSkipped = true; -// skip tenant id primary key column -return next(); +if (tuple != null inMultiTenantTable !tenantColumnSkipped) { +Object value = getColumn(tuple, keySeqIndex); +if (value != null ((Number)value).longValue() == 1L) { +tenantColumnSkipped = true; +// skip tenant id primary key column +return next(); +} } if (tuple != null tenantColumnSkipped) { ResultTuple resultTuple = (ResultTuple)tuple; -ListCell cells = resultTuple.getResult().listCells(); -
[2/3] git commit: PHOENIX-1366 Use static constants
PHOENIX-1366 Use static constants Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/11206294 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/11206294 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/11206294 Branch: refs/heads/master Commit: 11206294c405ea843f0b4b81bdf12a049ba34a19 Parents: 3cbd85b Author: James Taylor jtay...@salesforce.com Authored: Sun Oct 26 22:25:32 2014 -0700 Committer: James Taylor jtay...@salesforce.com Committed: Sun Oct 26 22:39:40 2014 -0700 -- .../java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/11206294/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java index a03cda4..8edc7ae 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java @@ -29,6 +29,7 @@ import java.util.Collections; import java.util.List; import org.apache.commons.lang.StringEscapeUtils; +import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.Bytes; @@ -536,14 +537,14 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData, org.apache.pho if (tuple != null tenantColumnSkipped) { ResultTuple resultTuple = (ResultTuple)tuple; -ListKeyValue cells = resultTuple.getResult().list(); +ListCell cells = resultTuple.getResult().listCells(); KeyValue kv = new KeyValue(resultTuple.getResult().getRow(), TABLE_FAMILY_BYTES, TENANT_POS_SHIFT_BYTES, PDataType.TRUE_BYTES); -ListKeyValue newCells = Lists.newArrayListWithCapacity(cells.size() + 1); +ListCell newCells = Lists.newArrayListWithCapacity(cells.size() + 1); newCells.addAll(cells); newCells.add(kv); Collections.sort(newCells, KeyValue.COMPARATOR); -resultTuple.setResult(new Result(newCells)); +resultTuple.setResult(Result.create(newCells)); } return tuple;
Apache-Phoenix | 3.0 | Hadoop1 | Build Successful
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 [jeffreyz] PHOENIX-1382: Phoenix 4.2 RC Issue