You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Andy Schlaikjer (JIRA)" <ji...@apache.org> on 2012/09/12 02:53:07 UTC

[jira] [Created] (PIG-2915) Builtin TOP udf is sensitive to null input bags

Andy Schlaikjer created PIG-2915:
------------------------------------

             Summary: Builtin TOP udf is sensitive to null input bags
                 Key: PIG-2915
                 URL: https://issues.apache.org/jira/browse/PIG-2915
             Project: Pig
          Issue Type: Improvement
          Components: internal-udfs
    Affects Versions: 0.11
            Reporter: Andy Schlaikjer


TOP(max, sortField, inputBag) is sensitive to null inputBag arguments.

In some cases it is preferable for a UDF to simply return null for null inputs e.g. to avoid conditional logic in a script.

Most of the UDFs I write act this way, but TOP does not. This patch updates TOP to return null in the case where all input bags are null. Unit tests are included to confirm expected behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-2915) Builtin TOP udf is sensitive to null input bags

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

Dmitriy V. Ryaboy updated PIG-2915:
-----------------------------------

    Assignee: Andy Schlaikjer
      Status: Patch Available  (was: Open)
    
> Builtin TOP udf is sensitive to null input bags
> -----------------------------------------------
>
>                 Key: PIG-2915
>                 URL: https://issues.apache.org/jira/browse/PIG-2915
>             Project: Pig
>          Issue Type: Improvement
>          Components: internal-udfs
>    Affects Versions: 0.11
>            Reporter: Andy Schlaikjer
>            Assignee: Andy Schlaikjer
>         Attachments: pig-null_safe_top.1.patch
>
>
> TOP(max, sortField, inputBag) is sensitive to null inputBag arguments.
> In some cases it is preferable for a UDF to simply return null for null inputs e.g. to avoid conditional logic in a script.
> Most of the UDFs I write act this way, but TOP does not. This patch updates TOP to return null in the case where all input bags are null. Unit tests are included to confirm expected behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-2915) Builtin TOP udf is sensitive to null input bags

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

Dmitriy V. Ryaboy commented on PIG-2915:
----------------------------------------

Thanks Andy!

Brief notes:
1) Please add apache header on the new test file
2) Despite the fact that that's how the tests are currently organized, nothing is restricting us to putting files into org.apache.pig.test -- we can just as easily follow the more convenient method of putting them into the same package as the class being tested. Move the new one?
3) There are a few existing tests for Top in TestBuiltin and Piggybank (org.apache.pig.piggybank.test.evaluation.util.TestTop). Move them in here so we get a complete picture, and ensure they still pass?

                
> Builtin TOP udf is sensitive to null input bags
> -----------------------------------------------
>
>                 Key: PIG-2915
>                 URL: https://issues.apache.org/jira/browse/PIG-2915
>             Project: Pig
>          Issue Type: Improvement
>          Components: internal-udfs
>    Affects Versions: 0.11
>            Reporter: Andy Schlaikjer
>            Assignee: Andy Schlaikjer
>         Attachments: pig-null_safe_top.1.patch
>
>
> TOP(max, sortField, inputBag) is sensitive to null inputBag arguments.
> In some cases it is preferable for a UDF to simply return null for null inputs e.g. to avoid conditional logic in a script.
> Most of the UDFs I write act this way, but TOP does not. This patch updates TOP to return null in the case where all input bags are null. Unit tests are included to confirm expected behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-2915) Builtin TOP udf is sensitive to null input bags

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

Dmitriy V. Ryaboy commented on PIG-2915:
----------------------------------------

+1 will commit to trunk.
                
> Builtin TOP udf is sensitive to null input bags
> -----------------------------------------------
>
>                 Key: PIG-2915
>                 URL: https://issues.apache.org/jira/browse/PIG-2915
>             Project: Pig
>          Issue Type: Improvement
>          Components: internal-udfs
>    Affects Versions: 0.11
>            Reporter: Andy Schlaikjer
>            Assignee: Andy Schlaikjer
>         Attachments: pig-null_safe_top.1.patch, pig-null_safe_top.2.patch
>
>
> TOP(max, sortField, inputBag) is sensitive to null inputBag arguments.
> In some cases it is preferable for a UDF to simply return null for null inputs e.g. to avoid conditional logic in a script.
> Most of the UDFs I write act this way, but TOP does not. This patch updates TOP to return null in the case where all input bags are null. Unit tests are included to confirm expected behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-2915) Builtin TOP udf is sensitive to null input bags

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

Andy Schlaikjer updated PIG-2915:
---------------------------------

    Attachment: pig-null_safe_top.2.patch

Consolidates all TOP unit tests within org.apache.pig.builtin.TestTOP
                
> Builtin TOP udf is sensitive to null input bags
> -----------------------------------------------
>
>                 Key: PIG-2915
>                 URL: https://issues.apache.org/jira/browse/PIG-2915
>             Project: Pig
>          Issue Type: Improvement
>          Components: internal-udfs
>    Affects Versions: 0.11
>            Reporter: Andy Schlaikjer
>            Assignee: Andy Schlaikjer
>         Attachments: pig-null_safe_top.1.patch, pig-null_safe_top.2.patch
>
>
> TOP(max, sortField, inputBag) is sensitive to null inputBag arguments.
> In some cases it is preferable for a UDF to simply return null for null inputs e.g. to avoid conditional logic in a script.
> Most of the UDFs I write act this way, but TOP does not. This patch updates TOP to return null in the case where all input bags are null. Unit tests are included to confirm expected behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-2915) Builtin TOP udf is sensitive to null input bags

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

Andy Schlaikjer updated PIG-2915:
---------------------------------

    Attachment: pig-null_safe_top.1.patch

Here's the patch mentioned in description.
                
> Builtin TOP udf is sensitive to null input bags
> -----------------------------------------------
>
>                 Key: PIG-2915
>                 URL: https://issues.apache.org/jira/browse/PIG-2915
>             Project: Pig
>          Issue Type: Improvement
>          Components: internal-udfs
>    Affects Versions: 0.11
>            Reporter: Andy Schlaikjer
>         Attachments: pig-null_safe_top.1.patch
>
>
> TOP(max, sortField, inputBag) is sensitive to null inputBag arguments.
> In some cases it is preferable for a UDF to simply return null for null inputs e.g. to avoid conditional logic in a script.
> Most of the UDFs I write act this way, but TOP does not. This patch updates TOP to return null in the case where all input bags are null. Unit tests are included to confirm expected behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (PIG-2915) Builtin TOP udf is sensitive to null input bags

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

Andy Schlaikjer commented on PIG-2915:
--------------------------------------

Will do. Thanks Dmitriy.
                
> Builtin TOP udf is sensitive to null input bags
> -----------------------------------------------
>
>                 Key: PIG-2915
>                 URL: https://issues.apache.org/jira/browse/PIG-2915
>             Project: Pig
>          Issue Type: Improvement
>          Components: internal-udfs
>    Affects Versions: 0.11
>            Reporter: Andy Schlaikjer
>            Assignee: Andy Schlaikjer
>         Attachments: pig-null_safe_top.1.patch
>
>
> TOP(max, sortField, inputBag) is sensitive to null inputBag arguments.
> In some cases it is preferable for a UDF to simply return null for null inputs e.g. to avoid conditional logic in a script.
> Most of the UDFs I write act this way, but TOP does not. This patch updates TOP to return null in the case where all input bags are null. Unit tests are included to confirm expected behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (PIG-2915) Builtin TOP udf is sensitive to null input bags

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

Dmitriy V. Ryaboy updated PIG-2915:
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 0.11
           Status: Resolved  (was: Patch Available)
    
> Builtin TOP udf is sensitive to null input bags
> -----------------------------------------------
>
>                 Key: PIG-2915
>                 URL: https://issues.apache.org/jira/browse/PIG-2915
>             Project: Pig
>          Issue Type: Improvement
>          Components: internal-udfs
>    Affects Versions: 0.11
>            Reporter: Andy Schlaikjer
>            Assignee: Andy Schlaikjer
>             Fix For: 0.11
>
>         Attachments: pig-null_safe_top.1.patch, pig-null_safe_top.2.patch
>
>
> TOP(max, sortField, inputBag) is sensitive to null inputBag arguments.
> In some cases it is preferable for a UDF to simply return null for null inputs e.g. to avoid conditional logic in a script.
> Most of the UDFs I write act this way, but TOP does not. This patch updates TOP to return null in the case where all input bags are null. Unit tests are included to confirm expected behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira