@Override public void load( MapJoinTableContainer[] mapJoinTables, MapJoinTableContainerSerDe[] mapJoinTableSerdes) throws HiveException { Map<Integer, String> parentToInput = desc.getParentToInput(); Map<Integer, Long> parentKeyCounts = desc.getParentKeyCounts(); for (int pos = 0; pos < mapJoinTables.length; pos++) { if (pos == desc.getPosBigTable()) { continue; } String inputName = parentToInput.get(pos); LogicalInput input = tezContext.getInput(inputName); try { input.start(); tezContext .getTezProcessorContext() .waitForAnyInputReady(Collections.<Input>singletonList(input)); } catch (Exception e) { throw new HiveException(e); } try { KeyValueReader kvReader = (KeyValueReader) input.getReader(); Long keyCountObj = parentKeyCounts.get(pos); long keyCount = (keyCountObj == null) ? -1 : keyCountObj.longValue(); VectorMapJoinFastTableContainer vectorMapJoinFastTableContainer = new VectorMapJoinFastTableContainer(desc, hconf, keyCount); while (kvReader.next()) { vectorMapJoinFastTableContainer.putRow( null, (BytesWritable) kvReader.getCurrentKey(), null, (BytesWritable) kvReader.getCurrentValue()); } vectorMapJoinFastTableContainer.seal(); mapJoinTables[pos] = (MapJoinTableContainer) vectorMapJoinFastTableContainer; } catch (IOException e) { throw new HiveException(e); } catch (SerDeException e) { throw new HiveException(e); } catch (Exception e) { throw new HiveException(e); } } }
@Override public void run(Map<String, LogicalInput> inputs, Map<String, LogicalOutput> outputs) throws Exception { LOG.info("Running map: " + processorContext.getUniqueIdentifier()); initTask(); if (inputs.size() != 1 || outputs.size() != 1) { throw new IOException( "Cannot handle multiple inputs or outputs" + ", inputCount=" + inputs.size() + ", outputCount=" + outputs.size()); } LogicalInput in = inputs.values().iterator().next(); LogicalOutput out = outputs.values().iterator().next(); // Sanity check if (!(in instanceof MRInputLegacy)) { throw new IOException( new TezException("Only Simple Input supported. Input: " + in.getClass())); } MRInputLegacy input = (MRInputLegacy) in; input.init(); Configuration incrementalConf = input.getConfigUpdates(); if (incrementalConf != null) { for (Entry<String, String> entry : incrementalConf) { jobConf.set(entry.getKey(), entry.getValue()); } } KeyValueWriter kvWriter = null; if (!(out instanceof OnFileSortedOutput)) { kvWriter = ((MROutput) out).getWriter(); } else { kvWriter = ((OnFileSortedOutput) out).getWriter(); } if (useNewApi) { runNewMapper(jobConf, mrReporter, input, kvWriter); } else { runOldMapper(jobConf, mrReporter, input, kvWriter); } done(out); }