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

Method pickTest

test/org/apache/pig/test/TestPackage.java:139–194  ·  view source on GitHub ↗

To show that it does not have any type specific code

(byte t, boolean[] inner)

Source from the content-addressed store, hash-verified

137 * code
138 */
139 private void pickTest(byte t, boolean[] inner) throws ExecException, IOException {
140 Random r = new Random();
141 switch (t) {
142 case DataType.BAG:
143 runTest(GenRandomData.genRandSmallTupDataBag(r, 10, 100), inner, DataType.BAG);
144 break;
145 case DataType.BOOLEAN:
146 runTest(r.nextBoolean(), inner, DataType.BOOLEAN);
147 break;
148 case DataType.BYTEARRAY:
149 runTest(GenRandomData.genRandDBA(r), inner, DataType.BYTEARRAY);
150 break;
151 case DataType.BIGCHARARRAY: {
152 String s = GenRandomData.genRandString(r);
153 for (; s.length() < 65535;) {
154 s += GenRandomData.genRandString(r);
155 }
156 runTest(s, inner, DataType.CHARARRAY);
157 break;
158 }
159 case DataType.CHARARRAY:
160 runTest(GenRandomData.genRandString(r), inner, DataType.CHARARRAY);
161 break;
162 case DataType.DOUBLE:
163 runTest(r.nextDouble(), inner, DataType.DOUBLE);
164 break;
165 case DataType.FLOAT:
166 runTest(r.nextFloat(), inner, DataType.FLOAT);
167 break;
168 case DataType.INTEGER:
169 runTest(r.nextInt(), inner, DataType.INTEGER);
170 break;
171 case DataType.LONG:
172 runTest(r.nextLong(), inner, DataType.LONG);
173 break;
174 case DataType.DATETIME:
175 DateTimeWritable.setupAvailableZoneIds();
176 runTest(new DateTime(r.nextLong()), inner, DataType.DATETIME);
177 break;
178 case DataType.MAP:
179 case DataType.INTERNALMAP:
180 case DataType.BYTE:
181 return; // map not key type
182 case DataType.TUPLE:
183 runTest(GenRandomData.genRandSmallBagTuple(r, 10, 100), inner, DataType.TUPLE);
184 break;
185 case DataType.BIGINTEGER:
186 runTest(new BigInteger(256, r), inner, DataType.BIGINTEGER);
187 break;
188 case DataType.BIGDECIMAL:
189 runTest(new BigDecimal(r.nextDouble()), inner, DataType.BIGDECIMAL);
190 break;
191 default:
192 fail("No test case for type " + DataType.findTypeName(t));
193 }
194 }
195
196

Callers 1

testOperatorMethod · 0.95

Calls 12

runTestMethod · 0.95
genRandDBAMethod · 0.95
genRandStringMethod · 0.95
setupAvailableZoneIdsMethod · 0.95
genRandSmallBagTupleMethod · 0.95
findTypeNameMethod · 0.95
lengthMethod · 0.80
nextDoubleMethod · 0.45
nextFloatMethod · 0.45
nextIntMethod · 0.45
nextLongMethod · 0.45

Tested by

no test coverage detected