MCPcopy Create free account
hub / github.com/apache/pig / testDistinct

Method testDistinct

test/org/apache/pig/test/TestLargeFile.java:144–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

142 }
143
144 @Test
145 public void testDistinct() throws Exception {
146 System.out.println("Running testDistinct...");
147 pig.registerQuery("A = load " + fileName + ";");
148 pig.registerQuery("B = distinct A;");
149
150 Iterator <Tuple> B = pig.openIterator("B");
151
152 Integer[] COUNT_Test = new Integer[max_rand];
153 Integer[] COUNT_Data = new Integer[max_rand];
154
155 for(int i = 0; i < max_rand; i++) {
156 COUNT_Test[i] = 0;
157 if (COUNT[i] > 0) {
158 COUNT_Data[i] = 1;
159 } else {
160 COUNT_Data[i] = 0;
161 }
162 }
163
164 while(B.hasNext()) {
165 int temp = DataType.toInteger(B.next().get(0));
166 COUNT_Test[temp] ++;
167 }
168
169 for(int i = 0; i < max_rand; i++) {
170 assertEquals(COUNT_Test[i].intValue(), COUNT_Data[i].intValue());
171 }
172 }
173}

Callers

nothing calls this directly

Calls 7

toIntegerMethod · 0.95
openIteratorMethod · 0.80
getMethod · 0.65
registerQueryMethod · 0.45
hasNextMethod · 0.45
nextMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected