droudnitsky commented on PR #7389:
URL: https://github.com/apache/hbase/pull/7389#issuecomment-3418796428

   > > Checked the code, this is only used in CompareFilter?
   
   > Yes those are the only types of filters one can use the problematic byte 
array comparator with.
   
   This was not accurate - any filter which takes a `ByteArrayComparable` can 
use the problematic byte array comparator, and majority of those (5/8) filters 
are an extension of `CompareFilter` , but there are 3 outlier ColumnValue 
filters I found which do not extend  `CompareFilter`:  
   org.apache.hadoop.hbase.filter.ColumnValueFilter
   org.apache.hadoop.hbase.filter.SingleColumnValueExcludeFilter
   org.apache.hadoop.hbase.filter.SingleColumnValueFilter
   
   So those 3 filters need special handling , and the other 5 filters can be 
handled through `CompareFilter`. Used chatgpt + ClassGraph to identify all 
filters which take a `ByteArrayComparable` -
   ```
       String pkg = "org.apache.hadoop.hbase.filter"; // <-- the package to scan
       List<Class<?>> hits = new ArrayList<>();
   
       try (ScanResult scan = new ClassGraph()
         .acceptPackages(pkg)
         .enableClassInfo()
         .scan()) {
   
         for (ClassInfo ci : scan.getAllClasses()) {
           Class<?> cls = ci.loadClass();
           for (Constructor<?> ctor : cls.getDeclaredConstructors()) {
             for (Class<?> pt : ctor.getParameterTypes()) {
               if 
(pt.getName().equals("org.apache.hadoop.hbase.filter.ByteArrayComparable")   // 
FQCN safer
                 || pt.getSimpleName().equals("ByteArrayComparable")) {  // 
simple name
                 hits.add(cls);
                 break;
               }
             }
           }
         }
       }
       System.out.println("matches: " + hits.size());
   
   org.apache.hadoop.hbase.filter.ColumnValueFilter
   org.apache.hadoop.hbase.filter.CompareFilter
   org.apache.hadoop.hbase.filter.DependentColumnFilter
   org.apache.hadoop.hbase.filter.FamilyFilter
   org.apache.hadoop.hbase.filter.QualifierFilter
   org.apache.hadoop.hbase.filter.RowFilter
   org.apache.hadoop.hbase.filter.SingleColumnValueExcludeFilter
   org.apache.hadoop.hbase.filter.SingleColumnValueFilter
   org.apache.hadoop.hbase.filter.ValueFilter
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to