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

Method MakeArray

src/org/apache/pig/pen/util/DisplayExamples.java:317–330  ·  view source on GitHub ↗
(Operator op, DataBag bag)

Source from the content-addressed store, hash-verified

315 }
316
317 static String[][] MakeArray(Operator op, DataBag bag)
318 throws Exception {
319 int rows = (int) bag.size();
320 int cols = ((LogicalRelationalOperator)op).getSchema().getFields().size();
321 String[][] table = new String[rows][cols];
322 Iterator<Tuple> it = bag.iterator();
323 for (int i = 0; i < rows; ++i) {
324 Tuple t = it.next();
325 for (int j = 0; j < cols; ++j) {
326 table[i][j] = ShortenField(t.get(j));
327 }
328 }
329 return table;
330 }
331
332 static String ShortenField(Object d) throws ExecException {
333 if (d instanceof Tuple)

Callers 2

printTabularMethod · 0.95
printNestedTabularMethod · 0.95

Calls 7

ShortenFieldMethod · 0.95
getMethod · 0.95
sizeMethod · 0.65
getSchemaMethod · 0.65
iteratorMethod · 0.65
getFieldsMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected