You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Richard Ding (JIRA)" <ji...@apache.org> on 2011/04/18 22:35:05 UTC

[jira] [Created] (PIG-1998) Allow macro to return void

Allow macro to return void
--------------------------

                 Key: PIG-1998
                 URL: https://issues.apache.org/jira/browse/PIG-1998
             Project: Pig
          Issue Type: Improvement
          Components: impl
    Affects Versions: 0.9.0
            Reporter: Richard Ding
            Assignee: Richard Ding
             Fix For: 0.9.0


Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:

1. If a macro doesn't output any alias, it must specify void as return value. For example:

{code}  
define mymacro(...) returns void {
   ... ...
};
{code}

2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:

{code}
mymacro(...);
{code}

3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:

{code}  
define mymacro(...) returns B {
   ... ...
   $B = filter ...;
};
{code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-1998) Allow macro to return void

Posted by "Richard Ding (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Ding updated PIG-1998:
------------------------------

    Attachment:     (was: PIG-1998_1.patch)

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-1998) Allow macro to return void

Posted by "Richard Ding (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025898#comment-13025898 ] 

Richard Ding commented on PIG-1998:
-----------------------------------

Patch 2 committed to both trunk and 0.9 branch. I'll add new patches to address additional review comments.

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch, PIG-1998_2.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-1998) Allow macro to return void

Posted by "Richard Ding (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Ding updated PIG-1998:
------------------------------

    Status: Patch Available  (was: Open)

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch, PIG-1998_2.patch, PIG-1998_3.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-1998) Allow macro to return void

Posted by "Richard Ding (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Ding updated PIG-1998:
------------------------------

    Attachment: PIG-1998_1.patch

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-1998) Allow macro to return void

Posted by "Richard Ding (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Ding updated PIG-1998:
------------------------------

    Attachment: PIG-1998_2.patch

Attaching a new patch that addresses Xuefu's review comments.

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch, PIG-1998_2.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-1998) Allow macro to return void

Posted by "Xuefu Zhang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025600#comment-13025600 ] 

Xuefu Zhang commented on PIG-1998:
----------------------------------

For patch PIG-1998_2.patch:

1. in the following grammar, the second rule should be just ^(RETURN_VAL). With that, "return void" is equivalent to return zero alias. So in the code, we don't need to do this kind of check: rets.size() == 1 && rets.get(0).equals("void")

+macro_return_clause 
+    : RETURNS alias (COMMA alias)*
+        -> ^(RETURN_VAL alias+)
+    | RETURNS VOID 
+        -> ^(RETURN_VAL VOID)

2. The bigger concern is actually the newly added method validate(). I don't think the StreamingTokenizer will meet our needs. For instance, it's not able to recognized Pig single line comments such as:

 -- this is a single line comment.

Even if this isn't a problem, the maintenance overhead could evolve to a nightmare for us in long run. I don't necessarily have a better idea, but I think we should at least give more thoughts on this.


> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch, PIG-1998_2.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-1998) Allow macro to return void

Posted by "Xuefu Zhang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025433#comment-13025433 ] 

Xuefu Zhang commented on PIG-1998:
----------------------------------

For patch PIG-1998_1.patch,

1. I don't see VOID keyword is defined or used in any of the grammar rules.

2. Grammar rules inline_return_clause have overlap

3. Will re-review once the patch is updated. 

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-1998) Allow macro to return void

Posted by "Xuefu Zhang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13027926#comment-13027926 ] 

Xuefu Zhang commented on PIG-1998:
----------------------------------

+1 Patch PIG-1998_3.patch looks good.

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch, PIG-1998_2.patch, PIG-1998_3.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-1998) Allow macro to return void

Posted by "Richard Ding (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Ding updated PIG-1998:
------------------------------

    Attachment: PIG-1998_1.patch

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-1998) Allow macro to return void

Posted by "Richard Ding (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13022813#comment-13022813 ] 

Richard Ding commented on PIG-1998:
-----------------------------------

Unit tests pass.

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-1998) Allow macro to return void

Posted by "Richard Ding (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13022393#comment-13022393 ] 

Richard Ding commented on PIG-1998:
-----------------------------------

Patch-test results:

{code}
     [exec] -1 overall.  
     [exec] 
     [exec]     +1 @author.  The patch does not contain any @author tags.
     [exec] 
     [exec]     +1 tests included.  The patch appears to include 5 new or modified tests.
     [exec] 
     [exec]     +1 javadoc.  The javadoc tool did not generate any warning messages.
     [exec] 
     [exec]     -1 javac.  The applied patch generated 952 javac compiler warnings (more than the trunk's current 948 warnings).
     [exec] 
     [exec]     +1 findbugs.  The patch does not introduce any new Findbugs warnings.
     [exec] 
     [exec]     +1 release audit.  The applied patch does not increase the total number of release audit warnings.
{code}

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-1998) Allow macro to return void

Posted by "Richard Ding (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Ding updated PIG-1998:
------------------------------

      Resolution: Fixed
    Hadoop Flags: [Reviewed]
          Status: Resolved  (was: Patch Available)

Patch committed to trunk and 0.9 branch.

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch, PIG-1998_2.patch, PIG-1998_3.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-1998) Allow macro to return void

Posted by "Richard Ding (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Ding updated PIG-1998:
------------------------------

    Attachment: PIG-1998_3.patch

The purpose of this validation is to give user an early warning when an alias in the returns clause doesn't appear in the macro as $<alias>. It performs a simple parsing using StreamTokenizer.

> Allow macro to return void
> --------------------------
>
>                 Key: PIG-1998
>                 URL: https://issues.apache.org/jira/browse/PIG-1998
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Richard Ding
>            Assignee: Richard Ding
>             Fix For: 0.9.0
>
>         Attachments: PIG-1998_1.patch, PIG-1998_2.patch, PIG-1998_3.patch
>
>
> Pig macro is allowed to not have output alias. But this property isn't clear from macro definition and macro invocation (macro inline). Here we propose to make it clear:
> 1. If a macro doesn't output any alias, it must specify void as return value. For example:
> {code}  
> define mymacro(...) returns void {
>    ... ...
> };
> {code}
> 2. If a macro doesn't output any alias, it must be invoked without return value. For example, to invoke above macro, just specify:
> {code}
> mymacro(...);
> {code}
> 3. Any non-void return alias in the macro definition must exist in the macro body and be prefixed with $. For example:
> {code}  
> define mymacro(...) returns B {
>    ... ...
>    $B = filter ...;
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira