HBASE-25421 There is no limit on the column length when creating a table (#2796)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
lidingshengHHU 2021-03-03 14:42:39 +08:00 committed by GitHub
parent e099ef349b
commit a4eb1aaf77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1078,6 +1078,10 @@ public class TableDescriptorBuilder {
if (family.getName() == null || family.getName().length <= 0) {
throw new IllegalArgumentException("Family name cannot be null or empty");
}
int flength = family.getName() == null ? 0 : family.getName().length;
if (flength > Byte.MAX_VALUE) {
throw new IllegalArgumentException("The length of family name is bigger than " + Byte.MAX_VALUE);
}
if (hasColumnFamily(family.getName())) {
throw new IllegalArgumentException("Family '"
+ family.getNameAsString() + "' already exists so cannot be added");