(PigContext pigContext, String file, String engine)
| 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 | } |
no test coverage detected