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 ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---