()
| 115 | } |
| 116 | |
| 117 | private void setUpHashTable() throws IOException { |
| 118 | FileSpec replFile = new FileSpec(repl, new FuncSpec(PigStorage.class.getName() + "()")); |
| 119 | POLoad ld = new POLoad(new OperatorKey("Repl File Loader", 1L), replFile); |
| 120 | PigContext pc = new PigContext(ExecType.MAPREDUCE, PigMapReduce.sJobConfInternal.get()); |
| 121 | pc.connect(); |
| 122 | |
| 123 | ld.setPc(pc); |
| 124 | for (Result res = ld.getNextTuple(); res.returnStatus != POStatus.STATUS_EOP; res = ld |
| 125 | .getNextTuple()) { |
| 126 | Tuple tup = (Tuple)res.result; |
| 127 | LoadFunc lf = ((LoadFunc)PigContext.instantiateFuncFromSpec(ld.getLFile().getFuncSpec())); |
| 128 | String key = lf.getLoadCaster().bytesToCharArray( |
| 129 | ((DataByteArray)tup.get(keyField)).get()); |
| 130 | Tuple csttup = TupleFactory.getInstance().newTuple(2); |
| 131 | csttup.set(0, key); |
| 132 | csttup.set(1, lf.getLoadCaster().bytesToInteger(((DataByteArray)tup.get(1)).get())); |
| 133 | DataBag vals = null; |
| 134 | if (replTbl.containsKey(key)) { |
| 135 | vals = replTbl.get(key); |
| 136 | } |
| 137 | else { |
| 138 | vals = BagFactory.getInstance().newDefaultBag(); |
| 139 | replTbl.put(key, vals); |
| 140 | } |
| 141 | vals.add(csttup); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | } |
| 146 |
no test coverage detected