()
| 233 | } |
| 234 | |
| 235 | @Test |
| 236 | public void testStoreComplexData() throws Exception { |
| 237 | inpDB = GenRandomData.genRandFullTupTextDataBag(new Random(), 10, 100); |
| 238 | storeAndCopyLocally(inpDB); |
| 239 | PigStorage ps = new PigStorage("\t"); |
| 240 | int size = 0; |
| 241 | BufferedReader br = new BufferedReader(new FileReader(outputFileName)); |
| 242 | for(String line=br.readLine();line!=null;line=br.readLine()){ |
| 243 | String[] flds = line.split("\t",-1); |
| 244 | Tuple t = new DefaultTuple(); |
| 245 | |
| 246 | ResourceFieldSchema mapfs = GenRandomData.getRandMapFieldSchema(); |
| 247 | ResourceFieldSchema bagfs = GenRandomData.getSmallTupDataBagFieldSchema(); |
| 248 | ResourceFieldSchema tuplefs = GenRandomData.getSmallTupleFieldSchema(); |
| 249 | |
| 250 | t.append(flds[0].compareTo("")!=0 ? ps.getLoadCaster().bytesToBag(flds[0].getBytes(), bagfs) : null); |
| 251 | t.append(flds[1].compareTo("")!=0 ? new DataByteArray(flds[1].getBytes()) : null); |
| 252 | t.append(flds[2].compareTo("")!=0 ? ps.getLoadCaster().bytesToCharArray(flds[2].getBytes()) : null); |
| 253 | t.append(flds[3].compareTo("")!=0 ? ps.getLoadCaster().bytesToDouble(flds[3].getBytes()) : null); |
| 254 | t.append(flds[4].compareTo("")!=0 ? ps.getLoadCaster().bytesToFloat(flds[4].getBytes()) : null); |
| 255 | t.append(flds[5].compareTo("")!=0 ? ps.getLoadCaster().bytesToInteger(flds[5].getBytes()) : null); |
| 256 | t.append(flds[6].compareTo("")!=0 ? ps.getLoadCaster().bytesToLong(flds[6].getBytes()) : null); |
| 257 | t.append(flds[7].compareTo("")!=0 ? ps.getLoadCaster().bytesToMap(flds[7].getBytes(), mapfs) : null); |
| 258 | t.append(flds[8].compareTo("")!=0 ? ps.getLoadCaster().bytesToTuple(flds[8].getBytes(), tuplefs) : null); |
| 259 | t.append(flds[9].compareTo("")!=0 ? ps.getLoadCaster().bytesToBoolean(flds[9].getBytes()) : null); |
| 260 | t.append(flds[10].compareTo("")!=0 ? ps.getLoadCaster().bytesToDateTime(flds[10].getBytes()) : null); |
| 261 | assertEquals(true, TestHelper.bagContains(inpDB, t)); |
| 262 | ++size; |
| 263 | } |
| 264 | assertEquals(true, size==inpDB.size()); |
| 265 | br.close(); |
| 266 | } |
| 267 | |
| 268 | @Test |
| 269 | public void testStoreComplexDataWithNull() throws Exception { |
nothing calls this directly
no test coverage detected