in flink-connector-hbase-base/src/main/java/org/apache/flink/connector/hbase/table/HBaseConnectorOptionsUtil.java [58:83]
public static void validatePrimaryKey(DataType dataType, int[] primaryKeyIndexes) {
HBaseTableSchema hbaseSchema = HBaseTableSchema.fromDataType(dataType);
if (!hbaseSchema.getRowKeyName().isPresent()) {
throw new IllegalArgumentException(
"HBase table requires to define a row key field. "
+ "A row key field is defined as an atomic type, "
+ "column families and qualifiers are defined as ROW type.");
}
if (primaryKeyIndexes.length == 0) {
return;
}
if (primaryKeyIndexes.length > 1) {
throw new IllegalArgumentException(
"HBase table doesn't support a primary Key on multiple columns. "
+ "The primary key of HBase table must be defined on row key field.");
}
if (!hbaseSchema
.getRowKeyName()
.get()
.equals(DataType.getFieldNames(dataType).get(primaryKeyIndexes[0]))) {
throw new IllegalArgumentException(
"Primary key of HBase table must be defined on the row key field. "
+ "A row key field is defined as an atomic type, "
+ "column families and qualifiers are defined as ROW type.");
}
}