MCPcopy Create free account
hub / github.com/apache/pig / equalByteArrays

Method equalByteArrays

src/org/apache/pig/data/DataType.java:1634–1650  ·  view source on GitHub ↗

Test whether two byte arrays (Java byte arrays not Pig byte arrays) are equal. I have no idea why we have this function. @param lhs byte array 1 @param rhs byte array 2 @return true if both are null or the two are the same length and have the same bytes.

(byte[] lhs, byte[] rhs)

Source from the content-addressed store, hash-verified

1632 * the same bytes.
1633 */
1634 public static boolean equalByteArrays(byte[] lhs, byte[] rhs) {
1635 if(lhs == null && rhs == null) {
1636 return true;
1637 }
1638 if(lhs == null || rhs == null) {
1639 return false;
1640 }
1641 if(lhs.length != rhs.length) {
1642 return false;
1643 }
1644 for(int i = 0; i < lhs.length; ++i) {
1645 if(lhs[i] != rhs[i]) {
1646 return false;
1647 }
1648 }
1649 return true;
1650 }
1651
1652
1653 /**

Callers 9

testBooleanToBytesMethod · 0.95
testIntegerToBytesMethod · 0.95
testLongToBytesMethod · 0.95
testFloatToBytesMethod · 0.95
testDoubleToBytesMethod · 0.95
testDateTimeToBytesMethod · 0.95
testTupleToBytesMethod · 0.95
testBagToBytesMethod · 0.95
testMapToBytesMethod · 0.95

Calls

no outgoing calls

Tested by 9

testBooleanToBytesMethod · 0.76
testIntegerToBytesMethod · 0.76
testLongToBytesMethod · 0.76
testFloatToBytesMethod · 0.76
testDoubleToBytesMethod · 0.76
testDateTimeToBytesMethod · 0.76
testTupleToBytesMethod · 0.76
testBagToBytesMethod · 0.76
testMapToBytesMethod · 0.76