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 Duo Zhang
parent a561c71f00
commit 824e7a46a2
1 changed files with 4 additions and 0 deletions

View File

@ -1068,6 +1068,10 @@ public class TableDescriptorBuilder {
if (family.getName() == null || family.getName().length <= 0) { if (family.getName() == null || family.getName().length <= 0) {
throw new IllegalArgumentException("Family name cannot be null or empty"); 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())) { if (hasColumnFamily(family.getName())) {
throw new IllegalArgumentException("Family '" throw new IllegalArgumentException("Family '"
+ family.getNameAsString() + "' already exists so cannot be added"); + family.getNameAsString() + "' already exists so cannot be added");