Author: rohini
Date: Wed Sep 2 21:48:03 2015
New Revision: 1700909
URL: http://svn.apache.org/r1700909
Log:
Fix test failure from PIG-4627: [Pig on Tez] Self join does not handle null
values correctly
Modified:
pig/branches/branch-0.15/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigBytesRawComparator.java
Modified:
pig/branches/branch-0.15/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigBytesRawComparator.java
URL:
http://svn.apache.org/viewvc/pig/branches/branch-0.15/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigBytesRawComparator.java?rev=1700909&r1=1700908&r2=1700909&view=diff
==============================================================================
---
pig/branches/branch-0.15/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigBytesRawComparator.java
(original)
+++
pig/branches/branch-0.15/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigBytesRawComparator.java
Wed Sep 2 21:48:03 2015
@@ -124,14 +124,20 @@ public class PigBytesRawComparator exten
if( dataByteArraysCompare ) {
rc = WritableComparator.compareBytes(b1, offset1, length1, b2,
offset2, length2);
} else {
- // Subtract 2, one for null byte and one for index byte. Also,
do not reverse the sign
- // of rc when mAsc[0] is false because
BinInterSedesTupleRawComparator.compare() already
- // takes that into account.
+ // Subtract 2, one for null byte and one for index byte.
rc = mWrappedComp.compare(b1, s1 + 1, l1 - 2, b2, s2 + 1, l2 -
2);
// handle PIG-927. If tuples are equal but any field inside
tuple is null,
// then we do not merge keys if indices are not same
- if (rc == 0 && mWrappedComp.hasComparedTupleNull())
- rc = b1[s1 + 1] - b2[s2 + 1];
+ if (rc == 0 && mWrappedComp.hasComparedTupleNull()) {
+ rc = b1[s1 + 1] - b2[s2 + 1];
+ // Redundant as there will not be any sort order with multiple
indices
+ // But just for sake of completeness.
+ if (!mAsc[0]) rc *= -1;
+ }
+ // PIG-4298 - Return here to avoid reversing the sign of rc when
+ // mAsc[0] is false because
BinInterSedesTupleRawComparator.compare()
+ // already takes that into account.
+ return rc;
}
} else {
// Two nulls are equal if indices are same