Details
-
Improvement
-
Status: Patch Available
-
Major
-
Resolution: Unresolved
-
2.0.0
-
None
Description
Currently is not possible creation of HBase table via HBaseStorageHandler with specified pre-split strategy.
I use it in my code with applied patch in that way:
public String buildCreateTblStatement(TableDescriptor tableDescriptor) { StringBuilder createTableStatement = ...; ... ... String tblProperties = buildTblProperties(tableDescriptor); if (StringUtils.isNotBlank(tblProperties)) { createTableStatement.append(" TBLPROPERTIES (" + tblProperties + ")"); } ... return createTableStatement.toString(); } private static String buildTblProperties(TableDescriptor tableDescriptor) { ... ... if (supportsPreSplit(tableDescriptor)) { sb.append(", "); sb.append(quoteInSingleQuotes(HBaseStorageHandler.SPLITS_NUMBER)); sb.append(" = "); sb.append(quoteInSingleQuotes(String.valueOf(tableDescriptor.getNumRegions()))); GeneratedPKDescriptor columnDescriptor = (GeneratedPKDescriptor) tableDescriptor.getPkDescriptors().get(0); sb.append(", "); sb.append(quoteInSingleQuotes(HBaseStorageHandler.SPLIT_ALGORITHM_FIRSTROW_KEY)); sb.append(" = "); sb.append(quoteInSingleQuotes(columnDescriptor.getPkGenerator().firstRowKey())); sb.append(", "); sb.append(quoteInSingleQuotes(HBaseStorageHandler.SPLIT_ALGORITHM_LASTROW_KEY)); sb.append(" = "); sb.append(quoteInSingleQuotes(columnDescriptor.getPkGenerator().lastRowKey())); } logger.trace("TBLPROPERTIES are [{}]", sb); return sb.toString(); }