You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Daniel Dai (JIRA)" <ji...@apache.org> on 2015/08/04 03:11:04 UTC

[jira] [Commented] (PIG-4642) Function call error, when comparing two instances of class "Tuple", should use "compareTuple()", while in current version the method "compare()" compares two instances of "Tuple" using itself: "compare()", which introduces a recursion error.

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

Daniel Dai commented on PIG-4642:
---------------------------------

No, it should use mComparator.compare, mComparator is of BinInterSedesTupleRawComparator/DefaultTupleRawComparator. Do you see any stack hit the recursion?

> Function call error, when comparing two instances of class "Tuple", should use "compareTuple()", while in current version the method "compare()" compares two instances of "Tuple" using itself: "compare()", which introduces a recursion error.
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: PIG-4642
>                 URL: https://issues.apache.org/jira/browse/PIG-4642
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.13.0, 0.14.0, 0.15.0
>            Reporter: songwanging
>
> In method "compare" of class: pig-0.15.0\src\org\apache\pig\backend\hadoop\executionengine\mapReduceLayer\PigTupleSortComparator.java 
> when comparing two instances of class "Tuple", should use "compareTuple", while in current version the method "compare" using itself: "compare", which introduces a recursion error.
>   public int compare(Object o1, Object o2) {
>         NullableTuple nt1 = (NullableTuple) o1;
>         NullableTuple nt2 = (NullableTuple) o2;
>         int rc = 0;
>         // If either are null, handle differently.
>         if (!nt1.isNull() && !nt2.isNull()) {
>             rc = mComparator.compare((Tuple) nt1.getValueAsPigType(), (Tuple) nt2.getValueAsPigType());
>         } 
>         ....
>         return rc;
>     }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)