(Scriptable array, Schema schema, int depth)
| 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 | } |
no test coverage detected