haridsv commented on code in PR #1813:
URL: https://github.com/apache/phoenix/pull/1813#discussion_r1479250015


##########
phoenix-core/src/main/java/org/apache/phoenix/util/CDCUtil.java:
##########
@@ -110,4 +109,25 @@ public static Scan initForRawScan(Scan scan) {
         }
         return scan;
     }
+
+    public static int compareCellFamilyAndQualifier(byte[] columnFamily1,
+                                                     byte[] columnQual1,
+                                                     byte[] columnFamily2,
+                                                     byte[] columnQual2) {
+        int familyNameComparison = CDCUtil.compare(columnFamily1, 
columnFamily2);
+        if (familyNameComparison != 0) {
+            return familyNameComparison;
+        }
+        return CDCUtil.compare(columnQual1, columnQual2);

Review Comment:
   Oh, I didn't know it was added in Java 9. There is also a 
`org.apache.hadoop.io.FastByteComparisons#compareTo`? I found a copy of this 
class in Phoenix that is named as `DescVarLengthFastByteComparisons` that is 
already being used in several places. I think it is using some native 
comparator so should be more efficient, besides reducing the code duplication.
   
   
   There is also 
[org.apache.avro.io.BinaryData#compareBytes](https://github.com/apache/avro/blob/d143d6262f7d6c688e695d1656f8609605835604/lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java#L183)
 (requires anew dependency for Phoenix, but it is an existing dependency for 
HBase)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to