[4/8] phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table
PHOENIX-2566 Support NOT NULL constraint for any column for immutable table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7d521ed9 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7d521ed9 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7d521ed9 Branch: refs/heads/4.x-HBase-0.98 Commit: 7d521ed9e8e4790e556d6b3ce978addb5a2a46d1 Parents: 41ea571 Author: James Taylor Authored: Tue Feb 13 23:14:58 2018 -0800 Committer: James Taylor Committed: Fri Mar 23 13:16:59 2018 -0700 -- .../apache/phoenix/end2end/AlterTableIT.java| 2 +- .../apache/phoenix/end2end/CreateTableIT.java | 5 +- .../end2end/QueryDatabaseMetaDataIT.java| 4 +- .../compile/TupleProjectionCompiler.java| 3 +- .../apache/phoenix/compile/UpsertCompiler.java | 38 .../phoenix/exception/SQLExceptionCode.java | 5 +- .../apache/phoenix/jdbc/PhoenixStatement.java | 8 +- .../apache/phoenix/schema/MetaDataClient.java | 37 .../org/apache/phoenix/schema/PColumnImpl.java | 6 +- .../org/apache/phoenix/schema/PTableImpl.java | 1 - .../org/apache/phoenix/util/SchemaUtil.java | 6 ++ .../phoenix/compile/QueryCompilerTest.java | 98 +++- 12 files changed, 158 insertions(+), 55 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/7d521ed9/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java index ab75d34..e6087b8 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java @@ -477,7 +477,7 @@ public class AlterTableIT extends ParallelStatsDisabledIT { stmt.execute(); fail("Should have failed since altering a table by adding a non-nullable column is not allowed."); } catch (SQLException e) { - assertEquals(SQLExceptionCode.CANNOT_ADD_NOT_NULLABLE_COLUMN.getErrorCode(), e.getErrorCode()); + assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), e.getErrorCode()); } finally { closeStatement(stmt); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/7d521ed9/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 1abc653..491889d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -36,7 +36,6 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -416,7 +415,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column ENTRY_POINT_NAME has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } @@ -432,7 +431,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column V has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/7d521ed9/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java index 8615bac..7a2d3e1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java +++ b/ph
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3)
Repository: phoenix Updated Branches: refs/heads/5.x-HBase-2.0 2dffba1ab -> ea628b4bc PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ea628b4b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ea628b4b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ea628b4b Branch: refs/heads/5.x-HBase-2.0 Commit: ea628b4bc26e236a417db9130efb5e29e5348b53 Parents: 2dffba1 Author: James Taylor Authored: Thu Feb 15 11:44:03 2018 -0800 Committer: James Taylor Committed: Thu Feb 15 11:58:56 2018 -0800 -- .../org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java | 4 ++-- .../org/apache/phoenix/compile/TupleProjectionCompiler.java | 3 ++- .../main/java/org/apache/phoenix/compile/UpsertCompiler.java | 2 +- .../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java | 8 4 files changed, 9 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea628b4b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java index 63b7c36..fbe2479 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java @@ -58,6 +58,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver; import org.apache.phoenix.coprocessor.ServerCachingEndpointImpl; import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver; +import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.schema.ColumnNotFoundException; @@ -934,8 +935,7 @@ public class QueryDatabaseMetaDataIT extends ParallelStatsDisabledIT { "ALTER TABLE " + tableName + " ADD z_string varchar not null primary key"); fail(); } catch (SQLException e) { -assertTrue(e.getMessage(), e.getMessage().contains( -"ERROR 1006 (42J04): Only nullable columns may be added to a multi-part row key.")); + assertEquals(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY.getErrorCode(), e.getErrorCode()); } conn1.createStatement().executeUpdate( "ALTER TABLE " + tableName + " ADD z_string varchar primary key"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea628b4b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java index d0b900c..fccded2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java @@ -183,8 +183,9 @@ public class TupleProjectionCompiler { SchemaUtil.getColumnName(table.getName().getString(), colName) : SchemaUtil.getColumnName(tableRef.getTableAlias(), colName); PName familyName = SchemaUtil.isPKColumn(sourceColumn) ? (retainPKColumns ? null : PNameFactory.newName(VALUE_COLUMN_FAMILY)) : sourceColumn.getFamilyName(); +// If we're not retaining the PK columns, then we should switch columns to be nullable PColumn column = new ProjectedColumn(PNameFactory.newName(aliasedName), familyName, -position++, sourceColumn.isNullable(), sourceColumnRef, sourceColumn.getColumnQualifierBytes()); +position++, sourceColumn.isNullable() || familyName != null, sourceColumnRef, sourceColumn.getColumnQualifierBytes()); projectedColumns.add(column); } EncodedCQCounter cqCounter = EncodedCQCounter.NULL_COUNTER; http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea628b4b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 57e138b..7e83ad5 100644 --- a/phoenix-core/src/main/java/org/apache/phoeni
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 4)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 8b1197053 -> 5e56ab47f PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 4) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5e56ab47 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5e56ab47 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5e56ab47 Branch: refs/heads/4.x-HBase-1.1 Commit: 5e56ab47f26a45a1bb46b581a8b45a30b6e58b5e Parents: 8b11970 Author: James Taylor Authored: Thu Feb 15 11:58:19 2018 -0800 Committer: James Taylor Committed: Thu Feb 15 11:58:19 2018 -0800 -- .../src/main/java/org/apache/phoenix/schema/MetaDataClient.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5e56ab47/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 6fa0141..b3d455e 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -3238,6 +3238,7 @@ public class MetaDataClient { changingPhoenixTableProperty = true; } } +boolean willBeImmutableRows = Boolean.TRUE.equals(isImmutableRows) || (isImmutableRows == null && table.isImmutableRows()); Boolean multiTenant = null; if (multiTenantProp != null) { if (multiTenantProp.booleanValue() != table.isMultiTenant()) { @@ -3350,7 +3351,7 @@ public class MetaDataClient { throw new SQLExceptionInfo.Builder(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); // changing to immutable or already immutable -} else if (Boolean.TRUE.equals(isImmutableRows) || (isImmutableRows == null && table.isImmutableRows())) { +} else if (!willBeImmutableRows) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.KEY_VALUE_NOT_NULL) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); } @@ -3395,7 +3396,7 @@ public class MetaDataClient { .setSchemaName(schemaName) .setTableName(tableName).build().buildException(); } -PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, isImmutableRows); +PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, willBeImmutableRows); columns.add(column); String pkName = null; Short keySeq = null;
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 05653cf11 -> 8b1197053 PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8b119705 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8b119705 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8b119705 Branch: refs/heads/4.x-HBase-1.1 Commit: 8b119705337709802710c9085f0ffcba1a067f35 Parents: 05653cf Author: James Taylor Authored: Thu Feb 15 11:44:03 2018 -0800 Committer: James Taylor Committed: Thu Feb 15 11:51:54 2018 -0800 -- .../org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java | 4 ++-- .../org/apache/phoenix/compile/TupleProjectionCompiler.java | 3 ++- .../main/java/org/apache/phoenix/compile/UpsertCompiler.java | 2 +- .../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java | 8 .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8b119705/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java index 8615bac..7a2d3e1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java @@ -55,6 +55,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver; import org.apache.phoenix.coprocessor.ServerCachingEndpointImpl; import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver; +import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.schema.ColumnNotFoundException; @@ -961,8 +962,7 @@ public class QueryDatabaseMetaDataIT extends ParallelStatsDisabledIT { "ALTER TABLE " + tableName + " ADD z_string varchar not null primary key"); fail(); } catch (SQLException e) { -assertTrue(e.getMessage(), e.getMessage().contains( -"ERROR 1006 (42J04): Only nullable columns may be added to a multi-part row key.")); + assertEquals(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY.getErrorCode(), e.getErrorCode()); } conn1.createStatement().executeUpdate( "ALTER TABLE " + tableName + " ADD z_string varchar primary key"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/8b119705/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java index d0b900c..fccded2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java @@ -183,8 +183,9 @@ public class TupleProjectionCompiler { SchemaUtil.getColumnName(table.getName().getString(), colName) : SchemaUtil.getColumnName(tableRef.getTableAlias(), colName); PName familyName = SchemaUtil.isPKColumn(sourceColumn) ? (retainPKColumns ? null : PNameFactory.newName(VALUE_COLUMN_FAMILY)) : sourceColumn.getFamilyName(); +// If we're not retaining the PK columns, then we should switch columns to be nullable PColumn column = new ProjectedColumn(PNameFactory.newName(aliasedName), familyName, -position++, sourceColumn.isNullable(), sourceColumnRef, sourceColumn.getColumnQualifierBytes()); +position++, sourceColumn.isNullable() || familyName != null, sourceColumnRef, sourceColumn.getColumnQualifierBytes()); projectedColumns.add(column); } EncodedCQCounter cqCounter = EncodedCQCounter.NULL_COUNTER; http://git-wip-us.apache.org/repos/asf/phoenix/blob/8b119705/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index be7e
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3)
Repository: phoenix Updated Branches: refs/heads/4.x-cdh5.11.2 24126735e -> 2063e0f1a PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2063e0f1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2063e0f1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2063e0f1 Branch: refs/heads/4.x-cdh5.11.2 Commit: 2063e0f1afe9ffe86193d45ecfa9a874a3739894 Parents: 2412673 Author: James Taylor Authored: Thu Feb 15 11:44:03 2018 -0800 Committer: James Taylor Committed: Thu Feb 15 11:49:17 2018 -0800 -- .../org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java | 4 ++-- .../org/apache/phoenix/compile/TupleProjectionCompiler.java | 3 ++- .../main/java/org/apache/phoenix/compile/UpsertCompiler.java | 2 +- .../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java | 8 .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2063e0f1/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java index ea83b41..a1bcf40 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java @@ -55,6 +55,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver; import org.apache.phoenix.coprocessor.ServerCachingEndpointImpl; import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver; +import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.schema.ColumnNotFoundException; @@ -961,8 +962,7 @@ public class QueryDatabaseMetaDataIT extends ParallelStatsDisabledIT { "ALTER TABLE " + tableName + " ADD z_string varchar not null primary key"); fail(); } catch (SQLException e) { -assertTrue(e.getMessage(), e.getMessage().contains( -"ERROR 1006 (42J04): Only nullable columns may be added to a multi-part row key.")); + assertEquals(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY.getErrorCode(), e.getErrorCode()); } conn1.createStatement().executeUpdate( "ALTER TABLE " + tableName + " ADD z_string varchar primary key"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2063e0f1/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java index d0b900c..fccded2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java @@ -183,8 +183,9 @@ public class TupleProjectionCompiler { SchemaUtil.getColumnName(table.getName().getString(), colName) : SchemaUtil.getColumnName(tableRef.getTableAlias(), colName); PName familyName = SchemaUtil.isPKColumn(sourceColumn) ? (retainPKColumns ? null : PNameFactory.newName(VALUE_COLUMN_FAMILY)) : sourceColumn.getFamilyName(); +// If we're not retaining the PK columns, then we should switch columns to be nullable PColumn column = new ProjectedColumn(PNameFactory.newName(aliasedName), familyName, -position++, sourceColumn.isNullable(), sourceColumnRef, sourceColumn.getColumnQualifierBytes()); +position++, sourceColumn.isNullable() || familyName != null, sourceColumnRef, sourceColumn.getColumnQualifierBytes()); projectedColumns.add(column); } EncodedCQCounter cqCounter = EncodedCQCounter.NULL_COUNTER; http://git-wip-us.apache.org/repos/asf/phoenix/blob/2063e0f1/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index be7e
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 8b7e1eeef -> e4b63d8c8 PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e4b63d8c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e4b63d8c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e4b63d8c Branch: refs/heads/4.x-HBase-1.2 Commit: e4b63d8c83c392a591eccb77791501bc5611189b Parents: 8b7e1ee Author: James Taylor Authored: Thu Feb 15 11:44:03 2018 -0800 Committer: James Taylor Committed: Thu Feb 15 11:47:39 2018 -0800 -- .../org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java | 4 ++-- .../org/apache/phoenix/compile/TupleProjectionCompiler.java | 3 ++- .../main/java/org/apache/phoenix/compile/UpsertCompiler.java | 2 +- .../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java | 8 .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4b63d8c/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java index 8615bac..7a2d3e1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java @@ -55,6 +55,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver; import org.apache.phoenix.coprocessor.ServerCachingEndpointImpl; import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver; +import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.schema.ColumnNotFoundException; @@ -961,8 +962,7 @@ public class QueryDatabaseMetaDataIT extends ParallelStatsDisabledIT { "ALTER TABLE " + tableName + " ADD z_string varchar not null primary key"); fail(); } catch (SQLException e) { -assertTrue(e.getMessage(), e.getMessage().contains( -"ERROR 1006 (42J04): Only nullable columns may be added to a multi-part row key.")); + assertEquals(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY.getErrorCode(), e.getErrorCode()); } conn1.createStatement().executeUpdate( "ALTER TABLE " + tableName + " ADD z_string varchar primary key"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4b63d8c/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java index d0b900c..fccded2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java @@ -183,8 +183,9 @@ public class TupleProjectionCompiler { SchemaUtil.getColumnName(table.getName().getString(), colName) : SchemaUtil.getColumnName(tableRef.getTableAlias(), colName); PName familyName = SchemaUtil.isPKColumn(sourceColumn) ? (retainPKColumns ? null : PNameFactory.newName(VALUE_COLUMN_FAMILY)) : sourceColumn.getFamilyName(); +// If we're not retaining the PK columns, then we should switch columns to be nullable PColumn column = new ProjectedColumn(PNameFactory.newName(aliasedName), familyName, -position++, sourceColumn.isNullable(), sourceColumnRef, sourceColumn.getColumnQualifierBytes()); +position++, sourceColumn.isNullable() || familyName != null, sourceColumnRef, sourceColumn.getColumnQualifierBytes()); projectedColumns.add(column); } EncodedCQCounter cqCounter = EncodedCQCounter.NULL_COUNTER; http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4b63d8c/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index be7e
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3)
Repository: phoenix Updated Branches: refs/heads/master 22c76a280 -> ef48ad2ea PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ef48ad2e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ef48ad2e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ef48ad2e Branch: refs/heads/master Commit: ef48ad2ea656dfb12795e061a3a542e6c05bf154 Parents: 22c76a2 Author: James Taylor Authored: Thu Feb 15 11:44:03 2018 -0800 Committer: James Taylor Committed: Thu Feb 15 11:46:19 2018 -0800 -- .../org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java | 4 ++-- .../org/apache/phoenix/compile/TupleProjectionCompiler.java | 3 ++- .../main/java/org/apache/phoenix/compile/UpsertCompiler.java | 2 +- .../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java | 8 .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef48ad2e/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java index 8615bac..7a2d3e1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java @@ -55,6 +55,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver; import org.apache.phoenix.coprocessor.ServerCachingEndpointImpl; import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver; +import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.schema.ColumnNotFoundException; @@ -961,8 +962,7 @@ public class QueryDatabaseMetaDataIT extends ParallelStatsDisabledIT { "ALTER TABLE " + tableName + " ADD z_string varchar not null primary key"); fail(); } catch (SQLException e) { -assertTrue(e.getMessage(), e.getMessage().contains( -"ERROR 1006 (42J04): Only nullable columns may be added to a multi-part row key.")); + assertEquals(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY.getErrorCode(), e.getErrorCode()); } conn1.createStatement().executeUpdate( "ALTER TABLE " + tableName + " ADD z_string varchar primary key"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef48ad2e/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java index d0b900c..fccded2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java @@ -183,8 +183,9 @@ public class TupleProjectionCompiler { SchemaUtil.getColumnName(table.getName().getString(), colName) : SchemaUtil.getColumnName(tableRef.getTableAlias(), colName); PName familyName = SchemaUtil.isPKColumn(sourceColumn) ? (retainPKColumns ? null : PNameFactory.newName(VALUE_COLUMN_FAMILY)) : sourceColumn.getFamilyName(); +// If we're not retaining the PK columns, then we should switch columns to be nullable PColumn column = new ProjectedColumn(PNameFactory.newName(aliasedName), familyName, -position++, sourceColumn.isNullable(), sourceColumnRef, sourceColumn.getColumnQualifierBytes()); +position++, sourceColumn.isNullable() || familyName != null, sourceColumnRef, sourceColumn.getColumnQualifierBytes()); projectedColumns.add(column); } EncodedCQCounter cqCounter = EncodedCQCounter.NULL_COUNTER; http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef48ad2e/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index be7e90c..92e3b8a 1
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.3 e126dd1dd -> 82ba1417f PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 3) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/82ba1417 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/82ba1417 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/82ba1417 Branch: refs/heads/4.x-HBase-1.3 Commit: 82ba1417fdd69a0ac57cbcf2f2327d4aa371bcd9 Parents: e126dd1 Author: James Taylor Authored: Thu Feb 15 11:44:03 2018 -0800 Committer: James Taylor Committed: Thu Feb 15 11:44:03 2018 -0800 -- .../org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java | 4 ++-- .../org/apache/phoenix/compile/TupleProjectionCompiler.java | 3 ++- .../main/java/org/apache/phoenix/compile/UpsertCompiler.java | 2 +- .../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java | 8 .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/82ba1417/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java index 8615bac..7a2d3e1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryDatabaseMetaDataIT.java @@ -55,6 +55,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver; import org.apache.phoenix.coprocessor.ServerCachingEndpointImpl; import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver; +import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.schema.ColumnNotFoundException; @@ -961,8 +962,7 @@ public class QueryDatabaseMetaDataIT extends ParallelStatsDisabledIT { "ALTER TABLE " + tableName + " ADD z_string varchar not null primary key"); fail(); } catch (SQLException e) { -assertTrue(e.getMessage(), e.getMessage().contains( -"ERROR 1006 (42J04): Only nullable columns may be added to a multi-part row key.")); + assertEquals(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY.getErrorCode(), e.getErrorCode()); } conn1.createStatement().executeUpdate( "ALTER TABLE " + tableName + " ADD z_string varchar primary key"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/82ba1417/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java index d0b900c..fccded2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/TupleProjectionCompiler.java @@ -183,8 +183,9 @@ public class TupleProjectionCompiler { SchemaUtil.getColumnName(table.getName().getString(), colName) : SchemaUtil.getColumnName(tableRef.getTableAlias(), colName); PName familyName = SchemaUtil.isPKColumn(sourceColumn) ? (retainPKColumns ? null : PNameFactory.newName(VALUE_COLUMN_FAMILY)) : sourceColumn.getFamilyName(); +// If we're not retaining the PK columns, then we should switch columns to be nullable PColumn column = new ProjectedColumn(PNameFactory.newName(aliasedName), familyName, -position++, sourceColumn.isNullable(), sourceColumnRef, sourceColumn.getColumnQualifierBytes()); +position++, sourceColumn.isNullable() || familyName != null, sourceColumnRef, sourceColumn.getColumnQualifierBytes()); projectedColumns.add(column); } EncodedCQCounter cqCounter = EncodedCQCounter.NULL_COUNTER; http://git-wip-us.apache.org/repos/asf/phoenix/blob/82ba1417/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index be7e
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 2)
Repository: phoenix Updated Branches: refs/heads/5.x-HBase-2.0 f72e842df -> 2dffba1ab PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum 2) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2dffba1a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2dffba1a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2dffba1a Branch: refs/heads/5.x-HBase-2.0 Commit: 2dffba1ab1d71509106f85b5d09bb2319af8c5c6 Parents: f72e842 Author: James Taylor Authored: Thu Feb 15 10:02:05 2018 -0800 Committer: James Taylor Committed: Thu Feb 15 10:02:05 2018 -0800 -- .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 8 .../src/main/java/org/apache/phoenix/schema/PTableImpl.java | 1 + .../src/main/java/org/apache/phoenix/schema/Sequence.java | 6 +++--- .../src/main/java/org/apache/phoenix/util/MetaDataUtil.java | 9 +++-- 4 files changed, 11 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2dffba1a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 26fd988..c64c101 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -3213,7 +3213,6 @@ public class MetaDataClient { } int position = table.getColumns().size(); -boolean isImmutableRows = table.isImmutableRows(); List currentPKs = table.getPKColumns(); PColumn lastPK = currentPKs.get(currentPKs.size()-1); @@ -3239,6 +3238,7 @@ public class MetaDataClient { changingPhoenixTableProperty = true; } } +boolean willBeImmutableRows = Boolean.TRUE.equals(isImmutableRows) || (isImmutableRows == null && table.isImmutableRows()); Boolean multiTenant = null; if (multiTenantProp != null) { if (multiTenantProp.booleanValue() != table.isMultiTenant()) { @@ -3350,7 +3350,7 @@ public class MetaDataClient { if(colDef.isPK()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); -} else if (Boolean.TRUE.equals(isImmutableRows) || (isImmutableRows == null && table.isImmutableRows())) { +} else if (!willBeImmutableRows) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.KEY_VALUE_NOT_NULL) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); } @@ -3395,7 +3395,7 @@ public class MetaDataClient { .setSchemaName(schemaName) .setTableName(tableName).build().buildException(); } -PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, isImmutableRows); +PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, willBeImmutableRows); columns.add(column); String pkName = null; Short keySeq = null; @@ -3433,7 +3433,7 @@ public class MetaDataClient { ColumnName indexColName = ColumnName.caseSensitiveColumnName(IndexUtil.getIndexColumnName(null, colDef.getColumnDefName().getColumnName())); Expression expression = new RowKeyColumnExpression(columns.get(i), new RowKeyValueAccessor(pkColumns, ++pkSlotPosition)); ColumnDef indexColDef = FACTORY.columnDef(indexColName, indexColDataType.getSqlTypeName(), colDef.isNull(), colDef.getMaxLength(), colDef.getScale(), true, colDef.getSortOrder(), expression.toString(), colDef.isRowTimestamp()); -PColumn indexColumn = newColumn(indexPosition++, indexColDef, Prima
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum)
Repository: phoenix Updated Branches: refs/heads/5.x-HBase-2.0 8f7c26b5c -> f72e842df PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f72e842d Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f72e842d Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f72e842d Branch: refs/heads/5.x-HBase-2.0 Commit: f72e842df100b12e124c4a5b818a41610f4dc577 Parents: 8f7c26b Author: James Taylor Authored: Wed Feb 14 20:15:58 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 20:15:58 2018 -0800 -- .../src/main/java/org/apache/phoenix/schema/MetaDataClient.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/f72e842d/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index f2538ab..26fd988 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -3350,7 +3350,7 @@ public class MetaDataClient { if(colDef.isPK()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); -} else if (!isImmutableRows) { +} else if (Boolean.TRUE.equals(isImmutableRows) || (isImmutableRows == null && table.isImmutableRows())) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.KEY_VALUE_NOT_NULL) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); }
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum)
Repository: phoenix Updated Branches: refs/heads/4.x-cdh5.11.2 abafae35a -> 24126735e PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/24126735 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/24126735 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/24126735 Branch: refs/heads/4.x-cdh5.11.2 Commit: 24126735e1f37f859a4b4257d3d46885f1eb4c68 Parents: abafae3 Author: James Taylor Authored: Wed Feb 14 20:05:17 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 20:09:11 2018 -0800 -- .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/24126735/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 10ad199..81a09af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -3189,7 +3189,6 @@ public class MetaDataClient { } int position = table.getColumns().size(); -boolean isImmutableRows = table.isImmutableRows(); List currentPKs = table.getPKColumns(); PColumn lastPK = currentPKs.get(currentPKs.size()-1); @@ -3207,6 +3206,8 @@ public class MetaDataClient { MetaPropertiesEvaluated metaPropertiesEvaluated = new MetaPropertiesEvaluated(); changingPhoenixTableProperty = evaluateStmtProperties(metaProperties,metaPropertiesEvaluated,table,schemaName,tableName); +// If changing isImmutableRows to true or it's not being changed and is already true +boolean willBeImmutableRows = Boolean.TRUE.equals(metaPropertiesEvaluated.getIsImmutableRows()) || (metaPropertiesEvaluated.getIsImmutableRows() == null && table.isImmutableRows()); Long timeStamp = TransactionUtil.getTableTimestamp(connection, table.isTransactional() || metaProperties.getNonTxToTx()); int numPkColumnsAdded = 0; @@ -3229,7 +3230,7 @@ public class MetaDataClient { if(colDef.isPK()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); -} else if (!isImmutableRows) { +} else if (!willBeImmutableRows) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.KEY_VALUE_NOT_NULL) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); } @@ -3274,7 +3275,7 @@ public class MetaDataClient { .setSchemaName(schemaName) .setTableName(tableName).build().buildException(); } -PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, isImmutableRows); +PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, willBeImmutableRows); columns.add(column); String pkName = null; Short keySeq = null;
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 6c0a83b39 -> 8b7e1eeef PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8b7e1eee Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8b7e1eee Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8b7e1eee Branch: refs/heads/4.x-HBase-1.2 Commit: 8b7e1eeef301a5ab1f7d8a824cd0f04a428b9dc7 Parents: 6c0a83b Author: James Taylor Authored: Wed Feb 14 20:05:17 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 20:07:52 2018 -0800 -- .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8b7e1eee/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 10ad199..81a09af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -3189,7 +3189,6 @@ public class MetaDataClient { } int position = table.getColumns().size(); -boolean isImmutableRows = table.isImmutableRows(); List currentPKs = table.getPKColumns(); PColumn lastPK = currentPKs.get(currentPKs.size()-1); @@ -3207,6 +3206,8 @@ public class MetaDataClient { MetaPropertiesEvaluated metaPropertiesEvaluated = new MetaPropertiesEvaluated(); changingPhoenixTableProperty = evaluateStmtProperties(metaProperties,metaPropertiesEvaluated,table,schemaName,tableName); +// If changing isImmutableRows to true or it's not being changed and is already true +boolean willBeImmutableRows = Boolean.TRUE.equals(metaPropertiesEvaluated.getIsImmutableRows()) || (metaPropertiesEvaluated.getIsImmutableRows() == null && table.isImmutableRows()); Long timeStamp = TransactionUtil.getTableTimestamp(connection, table.isTransactional() || metaProperties.getNonTxToTx()); int numPkColumnsAdded = 0; @@ -3229,7 +3230,7 @@ public class MetaDataClient { if(colDef.isPK()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); -} else if (!isImmutableRows) { +} else if (!willBeImmutableRows) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.KEY_VALUE_NOT_NULL) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); } @@ -3274,7 +3275,7 @@ public class MetaDataClient { .setSchemaName(schemaName) .setTableName(tableName).build().buildException(); } -PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, isImmutableRows); +PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, willBeImmutableRows); columns.add(column); String pkName = null; Short keySeq = null;
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum)
Repository: phoenix Updated Branches: refs/heads/master cc3c952b3 -> 22c76a280 PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/22c76a28 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/22c76a28 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/22c76a28 Branch: refs/heads/master Commit: 22c76a2802bdb85ee29028b6016ae688e07ed351 Parents: cc3c952 Author: James Taylor Authored: Wed Feb 14 20:05:17 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 20:06:07 2018 -0800 -- .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/22c76a28/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 10ad199..81a09af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -3189,7 +3189,6 @@ public class MetaDataClient { } int position = table.getColumns().size(); -boolean isImmutableRows = table.isImmutableRows(); List currentPKs = table.getPKColumns(); PColumn lastPK = currentPKs.get(currentPKs.size()-1); @@ -3207,6 +3206,8 @@ public class MetaDataClient { MetaPropertiesEvaluated metaPropertiesEvaluated = new MetaPropertiesEvaluated(); changingPhoenixTableProperty = evaluateStmtProperties(metaProperties,metaPropertiesEvaluated,table,schemaName,tableName); +// If changing isImmutableRows to true or it's not being changed and is already true +boolean willBeImmutableRows = Boolean.TRUE.equals(metaPropertiesEvaluated.getIsImmutableRows()) || (metaPropertiesEvaluated.getIsImmutableRows() == null && table.isImmutableRows()); Long timeStamp = TransactionUtil.getTableTimestamp(connection, table.isTransactional() || metaProperties.getNonTxToTx()); int numPkColumnsAdded = 0; @@ -3229,7 +3230,7 @@ public class MetaDataClient { if(colDef.isPK()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); -} else if (!isImmutableRows) { +} else if (!willBeImmutableRows) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.KEY_VALUE_NOT_NULL) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); } @@ -3274,7 +3275,7 @@ public class MetaDataClient { .setSchemaName(schemaName) .setTableName(tableName).build().buildException(); } -PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, isImmutableRows); +PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, willBeImmutableRows); columns.add(column); String pkName = null; Short keySeq = null;
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.3 e99b738b6 -> e126dd1dd PHOENIX-2566 Support NOT NULL constraint for any column for immutable table (addendum) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e126dd1d Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e126dd1d Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e126dd1d Branch: refs/heads/4.x-HBase-1.3 Commit: e126dd1dda5aa80e8296d3b0c84736b22b658999 Parents: e99b738 Author: James Taylor Authored: Wed Feb 14 20:05:17 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 20:05:17 2018 -0800 -- .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e126dd1d/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 10ad199..81a09af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -3189,7 +3189,6 @@ public class MetaDataClient { } int position = table.getColumns().size(); -boolean isImmutableRows = table.isImmutableRows(); List currentPKs = table.getPKColumns(); PColumn lastPK = currentPKs.get(currentPKs.size()-1); @@ -3207,6 +3206,8 @@ public class MetaDataClient { MetaPropertiesEvaluated metaPropertiesEvaluated = new MetaPropertiesEvaluated(); changingPhoenixTableProperty = evaluateStmtProperties(metaProperties,metaPropertiesEvaluated,table,schemaName,tableName); +// If changing isImmutableRows to true or it's not being changed and is already true +boolean willBeImmutableRows = Boolean.TRUE.equals(metaPropertiesEvaluated.getIsImmutableRows()) || (metaPropertiesEvaluated.getIsImmutableRows() == null && table.isImmutableRows()); Long timeStamp = TransactionUtil.getTableTimestamp(connection, table.isTransactional() || metaProperties.getNonTxToTx()); int numPkColumnsAdded = 0; @@ -3229,7 +3230,7 @@ public class MetaDataClient { if(colDef.isPK()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.NOT_NULLABLE_COLUMN_IN_ROW_KEY) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); -} else if (!isImmutableRows) { +} else if (!willBeImmutableRows) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.KEY_VALUE_NOT_NULL) .setColumnName(colDef.getColumnDefName().getColumnName()).build().buildException(); } @@ -3274,7 +3275,7 @@ public class MetaDataClient { .setSchemaName(schemaName) .setTableName(tableName).build().buildException(); } -PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, isImmutableRows); +PColumn column = newColumn(position++, colDef, PrimaryKeyConstraint.EMPTY, table.getDefaultFamilyName() == null ? null : table.getDefaultFamilyName().getString(), true, columnQualifierBytes, willBeImmutableRows); columns.add(column); String pkName = null; Short keySeq = null;
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table
Repository: phoenix Updated Branches: refs/heads/5.x-HBase-2.0 3e46a06db -> 8f7c26b5c PHOENIX-2566 Support NOT NULL constraint for any column for immutable table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8f7c26b5 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8f7c26b5 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8f7c26b5 Branch: refs/heads/5.x-HBase-2.0 Commit: 8f7c26b5c8c6f55ff40c09d5b194f78ed1bb0746 Parents: 3e46a06 Author: James Taylor Authored: Tue Feb 13 23:14:58 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 19:53:45 2018 -0800 -- .../apache/phoenix/end2end/AlterTableIT.java| 2 +- .../apache/phoenix/end2end/CreateTableIT.java | 4 +- .../apache/phoenix/compile/UpsertCompiler.java | 38 .../phoenix/exception/SQLExceptionCode.java | 5 +- .../apache/phoenix/schema/MetaDataClient.java | 36 +++ .../org/apache/phoenix/schema/PColumnImpl.java | 6 +- .../org/apache/phoenix/schema/PTableImpl.java | 1 - .../org/apache/phoenix/util/SchemaUtil.java | 6 ++ .../phoenix/compile/QueryCompilerTest.java | 98 +++- 9 files changed, 149 insertions(+), 47 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8f7c26b5/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java index 34186bb..cfc59bd 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java @@ -476,7 +476,7 @@ public class AlterTableIT extends ParallelStatsDisabledIT { stmt.execute(); fail("Should have failed since altering a table by adding a non-nullable column is not allowed."); } catch (SQLException e) { - assertEquals(SQLExceptionCode.CANNOT_ADD_NOT_NULLABLE_COLUMN.getErrorCode(), e.getErrorCode()); + assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), e.getErrorCode()); } finally { closeStatement(stmt); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/8f7c26b5/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index b7b0957..19ca055 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -415,7 +415,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column ENTRY_POINT_NAME has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } @@ -431,7 +431,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column V has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/8f7c26b5/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 0ac1c7b..57e138b 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -427,20 +427,20 @@ public class UpsertCompiler { targetColumns.addAll(Collections.nCopies(columnIndexesToBe.length, null)); Arrays.fill(columnIndexesToBe, -1); // TODO: necessary? So we'll get an AIOB exception if it's not replaced Arrays.fill(pkSlotIndexesToBe, -1); // TODO: necessary? So we'll get an AIOB exception if it's not replaced -BitSet pkColumnsSet = new BitSet(table.getPKColum
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table
Repository: phoenix Updated Branches: refs/heads/4.x-cdh5.11.2 35c2793dd -> abafae35a PHOENIX-2566 Support NOT NULL constraint for any column for immutable table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/abafae35 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/abafae35 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/abafae35 Branch: refs/heads/4.x-cdh5.11.2 Commit: abafae35a4af42e645f433eb62a93afde1963c63 Parents: 35c2793 Author: James Taylor Authored: Tue Feb 13 23:14:58 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 19:50:19 2018 -0800 -- .../apache/phoenix/end2end/AlterTableIT.java| 2 +- .../apache/phoenix/end2end/CreateTableIT.java | 5 +- .../apache/phoenix/compile/UpsertCompiler.java | 38 .../phoenix/exception/SQLExceptionCode.java | 5 +- .../apache/phoenix/schema/MetaDataClient.java | 36 +++ .../org/apache/phoenix/schema/PColumnImpl.java | 6 +- .../org/apache/phoenix/schema/PTableImpl.java | 1 - .../org/apache/phoenix/util/SchemaUtil.java | 6 ++ .../phoenix/compile/QueryCompilerTest.java | 98 +++- 9 files changed, 149 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/abafae35/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java index 17f08c4..dd895dc 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java @@ -475,7 +475,7 @@ public class AlterTableIT extends ParallelStatsDisabledIT { stmt.execute(); fail("Should have failed since altering a table by adding a non-nullable column is not allowed."); } catch (SQLException e) { - assertEquals(SQLExceptionCode.CANNOT_ADD_NOT_NULLABLE_COLUMN.getErrorCode(), e.getErrorCode()); + assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), e.getErrorCode()); } finally { closeStatement(stmt); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/abafae35/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 1abc653..491889d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -36,7 +36,6 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -416,7 +415,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column ENTRY_POINT_NAME has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } @@ -432,7 +431,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column V has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/abafae35/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 9a3724e..be7e90c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -431,20 +431,20 @@ public class UpsertCo
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 877350c78 -> 05653cf11 PHOENIX-2566 Support NOT NULL constraint for any column for immutable table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/05653cf1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/05653cf1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/05653cf1 Branch: refs/heads/4.x-HBase-1.1 Commit: 05653cf119bdd2d2ba839537103aa2669067dae7 Parents: 877350c Author: James Taylor Authored: Tue Feb 13 23:14:58 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 19:42:49 2018 -0800 -- .../apache/phoenix/end2end/AlterTableIT.java| 2 +- .../apache/phoenix/end2end/CreateTableIT.java | 5 +- .../apache/phoenix/compile/UpsertCompiler.java | 38 .../phoenix/exception/SQLExceptionCode.java | 5 +- .../apache/phoenix/schema/MetaDataClient.java | 36 +++ .../org/apache/phoenix/schema/PColumnImpl.java | 6 +- .../org/apache/phoenix/schema/PTableImpl.java | 1 - .../org/apache/phoenix/util/SchemaUtil.java | 6 ++ .../phoenix/compile/QueryCompilerTest.java | 98 +++- 9 files changed, 149 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/05653cf1/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java index 5265b09..d999f6a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java @@ -475,7 +475,7 @@ public class AlterTableIT extends ParallelStatsDisabledIT { stmt.execute(); fail("Should have failed since altering a table by adding a non-nullable column is not allowed."); } catch (SQLException e) { - assertEquals(SQLExceptionCode.CANNOT_ADD_NOT_NULLABLE_COLUMN.getErrorCode(), e.getErrorCode()); + assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), e.getErrorCode()); } finally { closeStatement(stmt); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/05653cf1/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 1abc653..491889d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -36,7 +36,6 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -416,7 +415,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column ENTRY_POINT_NAME has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } @@ -432,7 +431,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column V has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/05653cf1/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 9a3724e..be7e90c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -431,20 +431,20 @@ public class UpsertCo
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 a93ed98e0 -> 6c0a83b39 PHOENIX-2566 Support NOT NULL constraint for any column for immutable table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6c0a83b3 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6c0a83b3 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6c0a83b3 Branch: refs/heads/4.x-HBase-1.2 Commit: 6c0a83b39676fe906a2debf77f8ac5ba11b62815 Parents: a93ed98 Author: James Taylor Authored: Tue Feb 13 23:14:58 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 19:29:00 2018 -0800 -- .../apache/phoenix/end2end/AlterTableIT.java| 2 +- .../apache/phoenix/end2end/CreateTableIT.java | 5 +- .../apache/phoenix/compile/UpsertCompiler.java | 38 .../phoenix/exception/SQLExceptionCode.java | 5 +- .../apache/phoenix/schema/MetaDataClient.java | 36 +++ .../org/apache/phoenix/schema/PColumnImpl.java | 6 +- .../org/apache/phoenix/schema/PTableImpl.java | 1 - .../org/apache/phoenix/util/SchemaUtil.java | 6 ++ .../phoenix/compile/QueryCompilerTest.java | 98 +++- 9 files changed, 149 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6c0a83b3/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java index 17f08c4..dd895dc 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java @@ -475,7 +475,7 @@ public class AlterTableIT extends ParallelStatsDisabledIT { stmt.execute(); fail("Should have failed since altering a table by adding a non-nullable column is not allowed."); } catch (SQLException e) { - assertEquals(SQLExceptionCode.CANNOT_ADD_NOT_NULLABLE_COLUMN.getErrorCode(), e.getErrorCode()); + assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), e.getErrorCode()); } finally { closeStatement(stmt); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/6c0a83b3/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 1abc653..491889d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -36,7 +36,6 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -416,7 +415,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column ENTRY_POINT_NAME has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } @@ -432,7 +431,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column V has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/6c0a83b3/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 9a3724e..be7e90c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -431,20 +431,20 @@ public class UpsertCo
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table
Repository: phoenix Updated Branches: refs/heads/master dabc8ae4b -> cc3c952b3 PHOENIX-2566 Support NOT NULL constraint for any column for immutable table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cc3c952b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cc3c952b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cc3c952b Branch: refs/heads/master Commit: cc3c952b3f323d9a0ae6274e896b9e884d44d458 Parents: dabc8ae Author: James Taylor Authored: Tue Feb 13 23:14:58 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 19:27:21 2018 -0800 -- .../apache/phoenix/end2end/AlterTableIT.java| 2 +- .../apache/phoenix/end2end/CreateTableIT.java | 5 +- .../apache/phoenix/compile/UpsertCompiler.java | 38 .../phoenix/exception/SQLExceptionCode.java | 5 +- .../apache/phoenix/schema/MetaDataClient.java | 36 +++ .../org/apache/phoenix/schema/PColumnImpl.java | 6 +- .../org/apache/phoenix/schema/PTableImpl.java | 1 - .../org/apache/phoenix/util/SchemaUtil.java | 6 ++ .../phoenix/compile/QueryCompilerTest.java | 98 +++- 9 files changed, 149 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc3c952b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java index 17f08c4..dd895dc 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java @@ -475,7 +475,7 @@ public class AlterTableIT extends ParallelStatsDisabledIT { stmt.execute(); fail("Should have failed since altering a table by adding a non-nullable column is not allowed."); } catch (SQLException e) { - assertEquals(SQLExceptionCode.CANNOT_ADD_NOT_NULLABLE_COLUMN.getErrorCode(), e.getErrorCode()); + assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), e.getErrorCode()); } finally { closeStatement(stmt); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc3c952b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 1abc653..491889d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -36,7 +36,6 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -416,7 +415,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column ENTRY_POINT_NAME has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } @@ -432,7 +431,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column V has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc3c952b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 9a3724e..be7e90c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -431,20 +431,20 @@ public class UpsertCompiler {
phoenix git commit: PHOENIX-2566 Support NOT NULL constraint for any column for immutable table
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.3 25ae2568e -> e99b738b6 PHOENIX-2566 Support NOT NULL constraint for any column for immutable table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e99b738b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e99b738b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e99b738b Branch: refs/heads/4.x-HBase-1.3 Commit: e99b738b6b6e2d7487dd46e6374d2ce22a164869 Parents: 25ae256 Author: James Taylor Authored: Tue Feb 13 23:14:58 2018 -0800 Committer: James Taylor Committed: Wed Feb 14 19:26:12 2018 -0800 -- .../apache/phoenix/end2end/AlterTableIT.java| 2 +- .../apache/phoenix/end2end/CreateTableIT.java | 5 +- .../apache/phoenix/compile/UpsertCompiler.java | 38 .../phoenix/exception/SQLExceptionCode.java | 5 +- .../apache/phoenix/schema/MetaDataClient.java | 36 +++ .../org/apache/phoenix/schema/PColumnImpl.java | 6 +- .../org/apache/phoenix/schema/PTableImpl.java | 1 - .../org/apache/phoenix/util/SchemaUtil.java | 6 ++ .../phoenix/compile/QueryCompilerTest.java | 98 +++- 9 files changed, 149 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e99b738b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java index 17f08c4..dd895dc 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java @@ -475,7 +475,7 @@ public class AlterTableIT extends ParallelStatsDisabledIT { stmt.execute(); fail("Should have failed since altering a table by adding a non-nullable column is not allowed."); } catch (SQLException e) { - assertEquals(SQLExceptionCode.CANNOT_ADD_NOT_NULLABLE_COLUMN.getErrorCode(), e.getErrorCode()); + assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), e.getErrorCode()); } finally { closeStatement(stmt); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/e99b738b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 1abc653..491889d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -36,7 +36,6 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -416,7 +415,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column ENTRY_POINT_NAME has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } @@ -432,7 +431,7 @@ public class CreateTableIT extends ParallelStatsDisabledIT { conn.createStatement().execute(ddl); fail(" Non pk column V has a NOT NULL constraint"); } catch (SQLException sqle) { - assertEquals(SQLExceptionCode.INVALID_NOT_NULL_CONSTRAINT.getErrorCode(), +assertEquals(SQLExceptionCode.KEY_VALUE_NOT_NULL.getErrorCode(), sqle.getErrorCode()); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/e99b738b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 9a3724e..be7e90c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -431,20 +431,20 @@ public class UpsertCo