use of com.nearinfinity.honeycomb.hbase.HBaseStore in project honeycomb by altamiracorp.
the class BulkLoadMapper method setup.
@Override
protected void setup(Context context) throws IOException {
Configuration conf = context.getConfiguration();
char separator = conf.get(SEPARATOR, " ").charAt(0);
columns = conf.getStrings(SQL_COLUMNS);
String sqlTable = conf.get(SQL_TABLE);
String hbaseTable = conf.get(ConfigConstants.TABLE_NAME);
String columnFamily = conf.get(ConfigConstants.COLUMN_FAMILY);
// Check that necessary configuration variables are set
checkNotNull(conf.get(HConstants.ZOOKEEPER_QUORUM), HConstants.ZOOKEEPER_QUORUM + NOT_SET_ERROR);
checkNotNull(sqlTable, SQL_TABLE + NOT_SET_ERROR);
checkNotNull(columns, SQL_COLUMNS + NOT_SET_ERROR);
checkNotNull(hbaseTable, ConfigConstants.TABLE_NAME + NOT_SET_ERROR);
checkNotNull(columnFamily, ConfigConstants.COLUMN_FAMILY + NOT_SET_ERROR);
LOG.info("Zookeeper: " + conf.get(HConstants.ZOOKEEPER_QUORUM));
LOG.info("SQL Table: " + sqlTable);
LOG.info("HBase Table: " + hbaseTable);
LOG.info("HBase Column Family: " + columnFamily);
LOG.info("Input separator: '" + separator + "'");
final HTablePool pool = new HTablePool(conf, 1);
HBaseMetadata metadata = new HBaseMetadata(new PoolHTableProvider(hbaseTable, pool));
metadata.setColumnFamily(columnFamily);
HBaseStore store = new HBaseStore(metadata, null, new MetadataCache(metadata));
tableId = store.getTableId(sqlTable);
schema = store.getSchema(sqlTable);
mutationFactory = new MutationFactory(store);
mutationFactory.setColumnFamily(columnFamily);
rowParser = new RowParser(schema, columns, separator);
checkSqlColumnsMatch(sqlTable);
}
Aggregations