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

Method runEmbeddedScript

src/org/apache/pig/Main.java:1091–1112  ·  view source on GitHub ↗
(PigContext pigContext, String file, String engine)

Source from the content-addressed store, hash-verified

1089 }
1090
1091 private static int runEmbeddedScript(PigContext pigContext, String file, String engine)
1092 throws IOException {
1093 log.info("Run embedded script: " + engine);
1094 pigContext.connect();
1095 ScriptEngine scriptEngine = ScriptEngine.getInstance(engine);
1096 Map<String, List<PigStats>> statsMap = scriptEngine.run(pigContext, file);
1097 PigStatsUtil.setStatsMap(statsMap);
1098
1099 int failCount = 0;
1100 int totalCount = 0;
1101 for (List<PigStats> lst : statsMap.values()) {
1102 if (lst != null && !lst.isEmpty()) {
1103 for (PigStats stats : lst) {
1104 if (!stats.isSuccessful()) failCount++;
1105 totalCount++;
1106 }
1107 }
1108 }
1109 return (totalCount > 0 && failCount == totalCount) ? ReturnCode.FAILURE
1110 : (failCount > 0) ? ReturnCode.PARTIAL_FAILURE
1111 : ReturnCode.SUCCESS;
1112 }
1113
1114}

Callers 1

runMethod · 0.95

Calls 8

getInstanceMethod · 0.95
runMethod · 0.95
setStatsMapMethod · 0.95
infoMethod · 0.80
connectMethod · 0.65
valuesMethod · 0.45
isEmptyMethod · 0.45
isSuccessfulMethod · 0.45

Tested by

no test coverage detected