| 131 | |
| 132 | |
| 133 | public static final class LevMapper extends Mapper<LongWritable,Text,LongWritable,WritableVariableList> { |
| 134 | // config |
| 135 | private LineBurster burster = null; |
| 136 | // derived |
| 137 | private Log log = null; |
| 138 | private String hostDescr = null; |
| 139 | // result |
| 140 | private WritableVariableList accum = null; |
| 141 | |
| 142 | @Override |
| 143 | public void setup(final Context context) throws IOException { |
| 144 | log = LogFactory.getLog(LevMapper.class); |
| 145 | hostDescr = WritableUtils.hostDescr(); |
| 146 | log.info(".setup() " + hostDescr); |
| 147 | // read side-channel configuration |
| 148 | try { |
| 149 | burster = SerialUtils.readSerialiazlabeFromString(context.getConfiguration().get(MapRedScan.BURSTERSERFIELD)); |
| 150 | } catch (ClassNotFoundException e) { |
| 151 | throw new IOException(e.toString()); |
| 152 | } |
| 153 | accum = WritableVariableList.fromString(context.getConfiguration().get(DEFFIELD)); |
| 154 | } |
| 155 | |
| 156 | @Override |
| 157 | public void map(final LongWritable key, final Text value, final Context context) { |
| 158 | final BurstMap parsed = burster.parse(value.toString()); |
| 159 | if(!parsed.isEmpty()) { |
| 160 | accum.trackVariableLevelsFromRow(parsed); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | @Override |
| 165 | public void cleanup(final Context context) throws IOException, InterruptedException { |
| 166 | context.write(new LongWritable(0),accum); |
| 167 | log.info(".cleanup() " + hostDescr); |
| 168 | burster = null; |
| 169 | accum = null; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | public static final class LevReducer extends Reducer<LongWritable,WritableVariableList,LongWritable,WritableVariableList> { |
| 174 | @Override |
nothing calls this directly
no outgoing calls
no test coverage detected