()
| 170 | } |
| 171 | |
| 172 | @Test |
| 173 | public void test3() throws Exception { |
| 174 | File scriptFile = null; |
| 175 | try { |
| 176 | String[] script = { |
| 177 | "A = load '"+Util.encodeEscape(inputFile1.getAbsolutePath()) +"' ", |
| 178 | "using PigStorage(' ') as (a:int, b: ", |
| 179 | "{t:(t1:int,t2:int,t3:int,t4:int,c:chararray)});", |
| 180 | "C = foreach A {", |
| 181 | " temp1 = foreach b generate t1*100 as (key:int), ((t2+t3)*10) as (r:int);", |
| 182 | " temp2 = filter temp1 by key < 400;", |
| 183 | " temp3 = limit temp2 3;", |
| 184 | " temp4 = foreach temp3 generate key-r as (id:int);", |
| 185 | " temp5 = limit temp4 4;", |
| 186 | " temp6 = filter temp5 by id < 100;", |
| 187 | " generate flatten(temp6) as (id:int), a;", |
| 188 | "};", |
| 189 | "D = foreach C generate (", |
| 190 | " case id % 4", |
| 191 | " when 0 then true", |
| 192 | " else false", |
| 193 | " end", |
| 194 | ") as (check:boolean);" |
| 195 | }; |
| 196 | |
| 197 | scriptFile = Util.createLocalInputFile( "testFetchTest3.pig", script); |
| 198 | pigServer.registerScript(scriptFile.getAbsolutePath()); |
| 199 | |
| 200 | Iterator<Tuple> it = pigServer.openIterator("D"); |
| 201 | while (it.hasNext()) { |
| 202 | assertEquals(false, it.next().get(0)); |
| 203 | assertEquals(true, it.next().get(0)); |
| 204 | } |
| 205 | } |
| 206 | finally { |
| 207 | if (scriptFile != null) { |
| 208 | scriptFile.delete(); |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | @Test |
| 214 | public void test4() throws Exception { |
nothing calls this directly
no test coverage detected