get the key destributer in a mapper/reducer

49 views
Skip to first unread message

Andre

unread,
Jul 2, 2012, 3:38:13 PM7/2/12
to hba...@googlegroups.com
hi all

with the method call
keyDistributor.addInfo(job.getConfiguration());
we persist the key distributor in our configuration

WdTableInputFormat uses this code to recreate the key distributor:

    if (conf.get(ROW_KEY_DISTRIBUTOR_CLASS) != null) {

      String clazz = conf.get(ROW_KEY_DISTRIBUTOR_CLASS);

      try {

        rowKeyDistributor = (AbstractRowKeyDistributor) Class.forName(clazz).newInstance();

        if (conf.get(ROW_KEY_DISTRIBUTOR_PARAMS) != null) {

          rowKeyDistributor.init(conf.get(ROW_KEY_DISTRIBUTOR_PARAMS));

        }

      } catch (Exception e) {

        throw new RuntimeException("Cannot create row key distributor, " + ROW_KEY_DISTRIBUTOR_CLASS + ": " + clazz, e);

      }

    }


now i need the key distributor in my Mapper Class, to get the original row key, so actually i must copy and paste the below code to generate the key distributor out of the configuration
imho it would be better to make stuff this available directly in hbasewd, i.e. as a public static method in the WdTableInputFormat class

cheers
andre

Alex Baranau

unread,
Jul 2, 2012, 9:41:17 PM7/2/12
to hba...@googlegroups.com
Makes perfect sense to me. See https://github.com/sematext/HBaseWD/issues/14

Thank you for reporting!
Alex
Reply all
Reply to author
Forward
0 new messages