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

Method jsToPigMap

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

Source from the content-addressed store, hash-verified

356 }
357
358 private Object jsToPigMap(Scriptable object, Schema schema, int depth) {
359 debugConvertJSToPig(depth, "Map", object, schema);
360 Map<String, Object> map = new HashMap<String, Object>();
361 Object[] ids = object.getIds();
362 for (Object id : ids) {
363 if (id instanceof String) {
364 String name = (String) id;
365 Object value = object.get(name, object);
366 if (value instanceof NativeJavaObject) {
367 value = ((NativeJavaObject)value).unwrap();
368 } else if (value instanceof Undefined) {
369 value = null;
370 }
371 map.put(name, value);
372 }
373 }
374 debugReturn(depth, map);
375 return map;
376 }
377
378 private DataBag jsToPigBag(Scriptable array, Schema schema, int depth) throws FrontendException, ExecException {
379 debugConvertJSToPig(depth, "Bag", array, schema);

Callers 1

jsToPigTupleMethod · 0.95

Calls 4

debugConvertJSToPigMethod · 0.95
debugReturnMethod · 0.95
getMethod · 0.65
putMethod · 0.45

Tested by

no test coverage detected