我正面临着从hive到hbase的问题sqooping数据。
我正在使用apache sqoop中的HBaseImportJob。 它无法找到列族。虽然列族存在于表描述
中NAME => 'temp_table', FAMILIES => [{NAME => 'cf', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '1', V true
ERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', BLOCKSIZE => '65536', IN_ME
MORY => 'false', BLOCKCACHE => 'true'}]}
出现错误的代码部分是:
// Check to see if the table exists.
HTableDescriptor tableDesc = null;
byte [] familyBytes = Bytes.toBytes(familyName);
HColumnDescriptor colDesc = new HColumnDescriptor(familyBytes);
if (!admin.tableExists(tableName)) {
if (options.getCreateHBaseTable()) {
// Create the table.
LOG.info("Creating missing HBase table " + tableName);
tableDesc = new HTableDescriptor(tableName);
tableDesc.addFamily(colDesc);
admin.createTable(tableDesc);
} else {
LOG.warn("Could not find HBase table " + tableName);
LOG.warn("This job may fail. Either explicitly create the table,");
LOG.warn("or re-run with --hbase-create-table.");
}
} else {
// Table exists, so retrieve their current version
tableDesc = admin.getTableDescriptor(Bytes.toBytes(tableName));
// Check if current version do have specified column family
if (!tableDesc.hasFamily(familyBytes)) {
if (options.getCreateHBaseTable()) {
// Create the column family.
LOG.info("Creating missing column family " + familyName);
admin.disableTable(tableName);
admin.addColumn(tableName, colDesc);
admin.enableTable(tableName);
} else {
LOG.warn("Could not find column family " + familyName + " in table "
+ tableName);
LOG.warn("This job may fail. Either create the column family,");
LOG.warn("or re-run with --hbase-create-table.");
}
}
}
我收到以下错误:
2015-04-05 23:38:58,643 WARN org.apache.sqoop.mapreduce.HBaseImportJob: Could not find column family cf in table temp_table
2015-04-05 23:38:58,643 WARN org.apache.sqoop.mapreduce.HBaseImportJob: This job may fail. Either create the column family,
2015-04-05 23:38:58,643 WARN org.apache.sqoop.mapreduce.HBaseImportJob: or re-run with --hbase-create-table
任何想法?