hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Svetozar Ivanov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HIVE-13584) HBaseStorageHandler should support table pre-split
Date Sun, 10 Jul 2016 14:53:10 GMT

     [ https://issues.apache.org/jira/browse/HIVE-13584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Svetozar Ivanov updated HIVE-13584:
-----------------------------------
    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:

{code}
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();
}
{code}

  was:Currently is not possible creation of HBase table via HBaseStorageHandler with specified
pre-split strategy.


> HBaseStorageHandler should support table pre-split
> --------------------------------------------------
>
>                 Key: HIVE-13584
>                 URL: https://issues.apache.org/jira/browse/HIVE-13584
>             Project: Hive
>          Issue Type: Improvement
>          Components: HBase Handler
>    Affects Versions: 2.0.0
>            Reporter: Svetozar Ivanov
>            Assignee: Svetozar Ivanov
>              Labels: HBase, PreSplit
>         Attachments: HIVE-13584-branch-2.0.patch, HIVE-13584.1.patch, HIVE-13584.2.patch,
HIVE-13584.3.patch, HIVE-13584.4.patch, HIVE-13584.patch
>
>
> 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:
> {code}
> 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();
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message