You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Ashutosh Chauhan (JIRA)" <ji...@apache.org> on 2010/07/01 03:18:50 UTC

[jira] Commented: (PIG-1389) Implement Pig counter to track number of rows for each input files

    [ https://issues.apache.org/jira/browse/PIG-1389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884116#action_12884116 ] 

Ashutosh Chauhan commented on PIG-1389:
---------------------------------------

1.
{code}
+    /**
+     * Returns the counter name for the given input file name
+     * 
+     * @param fname the input file name
+     * @return the counter name
+     */
+    public static String getMultiInputsCounterName(String fname) {
+        return MULTI_INPUTS_RECORD_COUNTER +
+                new Path(fname).getName();
+    }

{code}

Its dangerous to assume that input is a file name. It may not be. It can be a jdbc location string. In particular, new Path(fname) parses fname and throws exception if String is not the way it expects it to be. So, at various places in the patch, dont assume the path will refer to a file location and particularly avoid using Path() and deal in Strings.

2. In PigRecordReader, initialization of Counters should be done in initialize() instead of getCurrentValue() that will avoid branching for every call of getCurrentValue.

3. Marking of features in MRCompiler while compilation is still in progress may lead to incorrect results. We do bunch of optimizations *after* MR plan is constructed. During which plan may get readjusted and whatever features were there in that particular MROper may get pushed around into different MR Oper. Better way to do this marking is post-construction of the MRPlan. Have a visitor which walks on the final MR Plan and marks the feature in those operator.

4. As an extension of 1. I think having a test for non-file based input/output location would really be useful. PIG-1229 would have made that super-easy.

> Implement Pig counter to track number of rows for each input files 
> -------------------------------------------------------------------
>
>                 Key: PIG-1389
>                 URL: https://issues.apache.org/jira/browse/PIG-1389
>             Project: Pig
>          Issue Type: Improvement
>    Affects Versions: 0.7.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.8.0
>
>         Attachments: PIG-1389.patch, PIG-1389.patch, PIG-1389_1.patch
>
>
> A MR job generated by Pig not only can have multiple outputs (in the case of multiquery) but also can have multiple inputs (in the case of join or cogroup). In both cases, the existing Hadoop counters (e.g. MAP_INPUT_RECORDS, REDUCE_OUTPUT_RECORDS) can not be used to count the number of records in the given input or output.  PIG-1299 addressed the case of multiple outputs.  We need to add new counters for jobs with multiple inputs.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.