()
| 860 | } |
| 861 | |
| 862 | @Test |
| 863 | public void returnCodeTest() throws Exception { |
| 864 | PrintWriter w = new PrintWriter(new FileWriter(PIG_FILE)); |
| 865 | w.println("A = load 'non-existine.file' as (a0:int, a1:int, a2:int);"); |
| 866 | w.println("B = filter A by a0 > 0;;"); |
| 867 | w.println("C = group B by $0;"); |
| 868 | w.println("D = join C by $0, B by $0;"); |
| 869 | w.println("store D into '" + OUTPUT_FILE + "';"); |
| 870 | w.close(); |
| 871 | |
| 872 | try { |
| 873 | String[] args = { "-x", execType, PIG_FILE }; |
| 874 | PigStats stats = PigRunner.run(args, null); |
| 875 | |
| 876 | assertTrue(!stats.isSuccessful()); |
| 877 | assertTrue(stats.getReturnCode() != 0); |
| 878 | if (execType.equals("spark")) { |
| 879 | //Currently, even if failed, spark engine will add a failed OutputStats, |
| 880 | // see: SparkPigStats.addFailJobStats() |
| 881 | assertTrue(stats.getOutputStats().size() == 1); |
| 882 | assertTrue(stats.getOutputStats().get(0).isSuccessful() == false); |
| 883 | } else { |
| 884 | assertTrue(stats.getOutputStats().size() == 0); |
| 885 | } |
| 886 | |
| 887 | } finally { |
| 888 | new File(PIG_FILE).delete(); |
| 889 | Util.deleteFile(cluster, OUTPUT_FILE); |
| 890 | } |
| 891 | } |
| 892 | |
| 893 | @Test |
| 894 | public void returnCodeTest2() throws Exception { |
nothing calls this directly
no test coverage detected