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

[jira] [Created] (PIG-2929) CONCAT returns null when 1 items is null

Nicholas Verbeck created PIG-2929:
-------------------------------------

             Summary: CONCAT returns null when 1 items is null
                 Key: PIG-2929
                 URL: https://issues.apache.org/jira/browse/PIG-2929
             Project: Pig
          Issue Type: Bug
          Components: documentation, internal-udfs
    Affects Versions: 0.9.2, 0.9.1, 0.9.0
            Reporter: Nicholas Verbeck


Just stumbled upon this issue over the weekend. It appears the built-in CONCAT function will return null in the advent of 1 item in the Tuple being null. If this is as intended it would be nice if the docs made note of this. Otherwise it would be nice if nulls where just skipped and a proper string of what was left was returned. If all items are null then just return null in that case.

--
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-2929) Improve documentation around AVG, CONCAT, MIN, MAX

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

Bill Graham updated PIG-2929:
-----------------------------

    Summary: Improve documentation around AVG, CONCAT, MIN, MAX  (was: CONCAT returns null when 1 items is null)

Looks good, thanks Cheolsoo! Renaming JIRA and committing.
                
> Improve documentation around AVG, CONCAT, MIN, MAX
> --------------------------------------------------
>
>                 Key: PIG-2929
>                 URL: https://issues.apache.org/jira/browse/PIG-2929
>             Project: Pig
>          Issue Type: Bug
>          Components: documentation, internal-udfs
>    Affects Versions: 0.9.0, 0.9.1, 0.9.2
>            Reporter: Nicholas Verbeck
>            Assignee: Cheolsoo Park
>             Fix For: 0.11
>
>         Attachments: PIG-2929-2.patch, PIG-2929.patch
>
>
> Just stumbled upon this issue over the weekend. It appears the built-in CONCAT function will return null in the advent of 1 item in the Tuple being null. If this is as intended it would be nice if the docs made note of this. Otherwise it would be nice if nulls where just skipped and a proper string of what was left was returned. If all items are null then just return null in that case.

--
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-2929) Improve documentation around AVG, CONCAT, MIN, MAX

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

Bill Graham updated PIG-2929:
-----------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)
    
> Improve documentation around AVG, CONCAT, MIN, MAX
> --------------------------------------------------
>
>                 Key: PIG-2929
>                 URL: https://issues.apache.org/jira/browse/PIG-2929
>             Project: Pig
>          Issue Type: Bug
>          Components: documentation, internal-udfs
>    Affects Versions: 0.9.0, 0.9.1, 0.9.2
>            Reporter: Nicholas Verbeck
>            Assignee: Cheolsoo Park
>             Fix For: 0.11
>
>         Attachments: PIG-2929-2.patch, PIG-2929.patch
>
>
> Just stumbled upon this issue over the weekend. It appears the built-in CONCAT function will return null in the advent of 1 item in the Tuple being null. If this is as intended it would be nice if the docs made note of this. Otherwise it would be nice if nulls where just skipped and a proper string of what was left was returned. If all items are null then just return null in that case.

--
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-2929) CONCAT returns null when 1 items is null

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

Cheolsoo Park updated PIG-2929:
-------------------------------

    Fix Version/s: 0.11
         Assignee: Cheolsoo Park
           Status: Patch Available  (was: Open)
    
> CONCAT returns null when 1 items is null
> ----------------------------------------
>
>                 Key: PIG-2929
>                 URL: https://issues.apache.org/jira/browse/PIG-2929
>             Project: Pig
>          Issue Type: Bug
>          Components: documentation, internal-udfs
>    Affects Versions: 0.9.2, 0.9.1, 0.9.0
>            Reporter: Nicholas Verbeck
>            Assignee: Cheolsoo Park
>             Fix For: 0.11
>
>         Attachments: PIG-2929.patch
>
>
> Just stumbled upon this issue over the weekend. It appears the built-in CONCAT function will return null in the advent of 1 item in the Tuple being null. If this is as intended it would be nice if the docs made note of this. Otherwise it would be nice if nulls where just skipped and a proper string of what was left was returned. If all items are null then just return null in that case.

--
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-2929) CONCAT returns null when 1 items is null

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

Bill Graham updated PIG-2929:
-----------------------------

    Status: Open  (was: Patch Available)

+1 to Cheolsoo's comments. A null value passed to a concat could be seen as an invalid record where a null result it warranted. Plus there's the backward compatibility issue.

If you want a concat with the semantics you describe, I think a custom UDF is the way go.

@Chealsoo, thanks for the documentation patch. Would you please make one minor edit, which is to remove the *now* from the text. Comments should be non-temporal.

{noformat}
The MIN function now ignores NULL values.
{noformat}
                
> CONCAT returns null when 1 items is null
> ----------------------------------------
>
>                 Key: PIG-2929
>                 URL: https://issues.apache.org/jira/browse/PIG-2929
>             Project: Pig
>          Issue Type: Bug
>          Components: documentation, internal-udfs
>    Affects Versions: 0.9.2, 0.9.1, 0.9.0
>            Reporter: Nicholas Verbeck
>            Assignee: Cheolsoo Park
>             Fix For: 0.11
>
>         Attachments: PIG-2929.patch
>
>
> Just stumbled upon this issue over the weekend. It appears the built-in CONCAT function will return null in the advent of 1 item in the Tuple being null. If this is as intended it would be nice if the docs made note of this. Otherwise it would be nice if nulls where just skipped and a proper string of what was left was returned. If all items are null then just return null in that case.

--
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-2929) CONCAT returns null when 1 items is null

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

Cheolsoo Park updated PIG-2929:
-------------------------------

    Attachment: PIG-2929-2.patch

Thank you for reviewing my patch Bill!

I removed "now". Please let me know if you want to edit anything more.
                
> CONCAT returns null when 1 items is null
> ----------------------------------------
>
>                 Key: PIG-2929
>                 URL: https://issues.apache.org/jira/browse/PIG-2929
>             Project: Pig
>          Issue Type: Bug
>          Components: documentation, internal-udfs
>    Affects Versions: 0.9.0, 0.9.1, 0.9.2
>            Reporter: Nicholas Verbeck
>            Assignee: Cheolsoo Park
>             Fix For: 0.11
>
>         Attachments: PIG-2929-2.patch, PIG-2929.patch
>
>
> Just stumbled upon this issue over the weekend. It appears the built-in CONCAT function will return null in the advent of 1 item in the Tuple being null. If this is as intended it would be nice if the docs made note of this. Otherwise it would be nice if nulls where just skipped and a proper string of what was left was returned. If all items are null then just return null in that case.

--
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-2929) CONCAT returns null when 1 items is null

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

Cheolsoo Park updated PIG-2929:
-------------------------------

    Status: Patch Available  (was: Open)
    
> CONCAT returns null when 1 items is null
> ----------------------------------------
>
>                 Key: PIG-2929
>                 URL: https://issues.apache.org/jira/browse/PIG-2929
>             Project: Pig
>          Issue Type: Bug
>          Components: documentation, internal-udfs
>    Affects Versions: 0.9.2, 0.9.1, 0.9.0
>            Reporter: Nicholas Verbeck
>            Assignee: Cheolsoo Park
>             Fix For: 0.11
>
>         Attachments: PIG-2929-2.patch, PIG-2929.patch
>
>
> Just stumbled upon this issue over the weekend. It appears the built-in CONCAT function will return null in the advent of 1 item in the Tuple being null. If this is as intended it would be nice if the docs made note of this. Otherwise it would be nice if nulls where just skipped and a proper string of what was left was returned. If all items are null then just return null in that case.

--
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-2929) CONCAT returns null when 1 items is null

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

Nicholas Verbeck commented on PIG-2929:
---------------------------------------

This all makes since. The addition of comments was more the main goal I was looking for. Just to prevent anyone else from having the assumptions I had.

However I did managed to solve the issue without a UDF by leveraging the ternary operations. ie. CONCAT(domain is null?"":domain, path is null?"":path). The case I had was concating parts of a URL back together. Where the Query String might be null if there wasn't one.
                
> CONCAT returns null when 1 items is null
> ----------------------------------------
>
>                 Key: PIG-2929
>                 URL: https://issues.apache.org/jira/browse/PIG-2929
>             Project: Pig
>          Issue Type: Bug
>          Components: documentation, internal-udfs
>    Affects Versions: 0.9.0, 0.9.1, 0.9.2
>            Reporter: Nicholas Verbeck
>            Assignee: Cheolsoo Park
>             Fix For: 0.11
>
>         Attachments: PIG-2929.patch
>
>
> Just stumbled upon this issue over the weekend. It appears the built-in CONCAT function will return null in the advent of 1 item in the Tuple being null. If this is as intended it would be nice if the docs made note of this. Otherwise it would be nice if nulls where just skipped and a proper string of what was left was returned. If all items are null then just return null in that case.

--
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-2929) CONCAT returns null when 1 items is null

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

Cheolsoo Park updated PIG-2929:
-------------------------------

    Attachment: PIG-2929.patch

Thank you very much for reporting an issue Nicholas!

In fact, this is documented [here|http://pig.apache.org/docs/r0.10.0/basic.html#nulls] although it is not very visible.

I am attaching a patch that updats the built-in function doc (including CONCAT, AVG, MIN, MAX, and SIZE) regarding nulls.

Regarding your suggestion of changing the behavior of CONCAT, even though it is total valid, I'm afraid that that could introduce backward incompatibilities. That is, some people may rely on that CONCAT returns nulls in their scripts. Given that this can be easily achieved by writing your own UDF, I prefer to keep the current behavior.

Please let me know if anyone thinks otherwise. Thanks! 
                
> CONCAT returns null when 1 items is null
> ----------------------------------------
>
>                 Key: PIG-2929
>                 URL: https://issues.apache.org/jira/browse/PIG-2929
>             Project: Pig
>          Issue Type: Bug
>          Components: documentation, internal-udfs
>    Affects Versions: 0.9.0, 0.9.1, 0.9.2
>            Reporter: Nicholas Verbeck
>             Fix For: 0.11
>
>         Attachments: PIG-2929.patch
>
>
> Just stumbled upon this issue over the weekend. It appears the built-in CONCAT function will return null in the advent of 1 item in the Tuple being null. If this is as intended it would be nice if the docs made note of this. Otherwise it would be nice if nulls where just skipped and a proper string of what was left was returned. If all items are null then just return null in that case.

--
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