modify hbase logical of create new hbase table

This commit is contained in:
tushengxia 2020-12-29 10:12:19 +08:00
parent 87c327bbbd
commit 2ada2db302
4 changed files with 9 additions and 3 deletions

View File

@ -141,7 +141,7 @@ HBase Connector supports two forms of table creation:
1. Create a table and directly link to a existing table in the HBase data source.
2. Create a new table that does not exist in the HBase data source.
2. Create a new table that does not exist in the HBase data source. We must specify 'external = false'.
Below is an example of how to create a table `schemaName.tableName` and link it to an existing table named `hbaseNamespace:hbaseTable` :

View File

@ -132,7 +132,7 @@ HBase连接器支持两种建表形式
1. 创建表并直接链接到HBase数据源中已存在的表。
2. 创建HBase数据源中不存在的新表。
2. 创建HBase数据源中不存在的新表。我们必须指定external = false
以下示例创建表`schemaName.tableName`并链接到一个名为`hbaseNamespace:hbaseTable`的现有表:

View File

@ -564,6 +564,12 @@ public class HBaseConnection
}
}
else {
if (table.isExternal()) {
throw new PrestoException(
HBaseErrorCode.HBASE_CREATE_ERROR,
format("Use lk creating new HBase table [%s], we must specify 'with(external=false)'. ", table.getTable()));
}
// create namespace if not exist
createNamespaceIfNotExist(this.getHbaseAdmin(), table.getSchema());

View File

@ -177,13 +177,13 @@ public class HBaseConnectorMetadata
{
checkNoRollback();
SchemaTableName tableName = tableMetadata.getTable();
HBaseTable table = hbaseConn.createTable(tableMetadata);
if (HBaseTableProperties.isExternal(tableMetadata.getProperties())) {
throw new PrestoException(
HBaseErrorCode.HBASE_CREATE_ERROR,
format("Use lk creating new HBase table [%s], we must specify 'with(external=false)'. ", tableName.toString()));
}
HBaseTable table = hbaseConn.createTable(tableMetadata);
// support create table xxx as select * from yyy
HBaseTableHandle handle =
new HBaseTableHandle(