[ https://issues.apache.org/jira/browse/STORM-607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14258915#comment-14258915 ]
ASF GitHub Bot commented on STORM-607: -------------------------------------- GitHub user dashengju opened a pull request: https://github.com/apache/storm/pull/364 [STORM-607] storm-hbase HBaseMapState should support user to customize the hbase-key & hbase-qualifier In HBaseMapState, user can specific hbase-qualifier by Options, and the hbase-key is composed by all the keys by multiPut's List<Object> keys. for example, If I have stream with <deal_id, date, pv>, grouped by <deal_id, date>, then, the hbase-key is composed by<deal_id, date>, the hbase-qualifier is pv. But when I want hbase-key is deal_id, and hbase-qualifier is pv+date, HBaseMapState can not support this. ================================================================================== With this patch, user can customize the hbase-key & hbase-qualifier by interface TridentHBaseMapMapper. As a old user, can use the old style like this: HBaseMapState.Options hbaseOptions = new HBaseMapState.Options(); hbaseOptions.mapMapper = new SimpleTridentHBaseMapMapper("pv"); Also, you can customize the hbase-key & hbase-qualifier like this: public class WithDateHBaseMapMapper implements TridentHBaseMapMapper { private String qualifierPrefix; public WithDateHBaseMapMapper(String qualifierPrefix) { this.qualifierPrefix = qualifierPrefix; } @Override public byte[] rowKey(List<Object> keys) { String dealId = String.valueOf(keys.get(0)); return dealId.getBytes(); } @Override public String qualifier(List<Object> keys) { String dateStr = String.valueOf(keys.get(1)); return qualifierPrefix + "_" + dateStr; } } HBaseMapState.Options hbaseOptions = new HBaseMapState.Options(); hbaseOptions.mapMapper = new WithDateHBaseMapMapper("pv"); You can merge this pull request into a Git repository by running: $ git pull https://github.com/dashengju/storm branch_for_storm_hbase_extend Alternatively you can review and apply these changes as the patch at: https://github.com/apache/storm/pull/364.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #364 ---- commit e6f509f82c30eaed5f2b3a6db5340d1438020adc Author: dashengju <dashen...@qq.com> Date: 2014-12-26T03:53:19Z make user to specific the key and qualifier of storm-hbase HBaseMapState ---- > storm-hbase HBaseMapState should support user to customize the hbase-key & > hbase-qualifier > ------------------------------------------------------------------------------------------ > > Key: STORM-607 > URL: https://issues.apache.org/jira/browse/STORM-607 > Project: Apache Storm > Issue Type: Improvement > Components: storm-hbase > Affects Versions: 0.9.3 > Reporter: DashengJu > Assignee: DashengJu > > In HBaseMapState, user can specific hbase-qualifier by Options, and the > hbase-key is composed by all the keys by multiPut's List<Object> keys. > for example, If I have stream with <deal_id, date, pv>, grouped by <deal_id, > date>, then, the hbase-key is composed by<deal_id, date>, the hbase-qualifier > is pv. > But when I want hbase-key is deal_id, and hbase-qualifier is pv+date, > HBaseMapState can not support this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)