()
| 922 | |
| 923 | |
| 924 | @Test //PIG-1893 |
| 925 | public void testEmptyFileCounter() throws Exception { |
| 926 | |
| 927 | PrintWriter w = new PrintWriter(new FileWriter("myinputfile")); |
| 928 | w.close(); |
| 929 | |
| 930 | Util.copyFromLocalToCluster(cluster, "myinputfile", "1.txt"); |
| 931 | |
| 932 | PrintWriter w1 = new PrintWriter(new FileWriter(PIG_FILE)); |
| 933 | w1.println("A = load '" + INPUT_FILE + "' as (a0:int, a1:int, a2:int);"); |
| 934 | w1.println("B = load '1.txt' as (a0:int, a1:int, a2:int);"); |
| 935 | w1.println("C = join A by a0, B by a0;"); |
| 936 | w1.println("store C into '" + OUTPUT_FILE + "';"); |
| 937 | w1.close(); |
| 938 | |
| 939 | try { |
| 940 | String[] args = { "-x", execType, PIG_FILE }; |
| 941 | PigStats stats = PigRunner.run(args, new TestNotificationListener(execType)); |
| 942 | |
| 943 | assertTrue(stats.isSuccessful()); |
| 944 | |
| 945 | assertEquals(1, stats.getNumberJobs()); |
| 946 | List<InputStats> inputs = stats.getInputStats(); |
| 947 | assertEquals(2, inputs.size()); |
| 948 | for (InputStats instats : inputs) { |
| 949 | if (instats.getLocation().endsWith("1.txt")) { |
| 950 | assertEquals(0, instats.getNumberRecords()); |
| 951 | } else { |
| 952 | assertEquals(5, instats.getNumberRecords()); |
| 953 | } |
| 954 | } |
| 955 | } finally { |
| 956 | new File(PIG_FILE).delete(); |
| 957 | Util.deleteFile(cluster, OUTPUT_FILE); |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | @Test //PIG-1893 |
| 962 | public void testEmptyFileCounter2() throws Exception { |
nothing calls this directly
no test coverage detected