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

Method jsToPigBag

src/org/apache/pig/scripting/js/JsFunction.java:378–391  ·  view source on GitHub ↗
(Scriptable array, Schema schema, int depth)

Source from the content-addressed store, hash-verified

376 }
377
378 private DataBag jsToPigBag(Scriptable array, Schema schema, int depth) throws FrontendException, ExecException {
379 debugConvertJSToPig(depth, "Bag", array, schema);
380 if (schema.size() == 1 && schema.getField(0).type == DataType.TUPLE) {
381 schema = schema.getField(0).schema;
382 }
383 List<Tuple> bag = new ArrayList<Tuple>();
384 for (Object id : array.getIds()) {
385 Scriptable arrayValue = (Scriptable)array.get(((Integer)id).intValue(), null);
386 bag.add(jsToPigTuple(arrayValue, schema, depth + 1));
387 }
388 DataBag result = BagFactory.getInstance().newDefaultBag(bag);
389 debugReturn(depth, result);
390 return result;
391 }
392
393}

Callers 1

jsToPigTupleMethod · 0.95

Calls 9

debugConvertJSToPigMethod · 0.95
jsToPigTupleMethod · 0.95
getInstanceMethod · 0.95
debugReturnMethod · 0.95
sizeMethod · 0.65
getMethod · 0.65
addMethod · 0.65
getFieldMethod · 0.45
newDefaultBagMethod · 0.45

Tested by

no test coverage detected