external/spark-hbase-connector/src/main/java/org/apache/hadoop/hbase/spark/SparkSQLPushDownFilter.java
/**
   * @param pbBytes A pb serialized instance
   * @return An instance of SparkSQLPushDownFilter
   * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
   */
@param pbBytes A pb serialized instance
@return An instance of SparkSQLPushDownFilter
@throws org.apache.hadoop.hbase.exceptions.DeserializationException
@param pbBytes A pb serialized instance @return An instance of SparkSQLPushDownFilter @throws org . apache . hadoop . hbase . exceptions . DeserializationException
@SuppressWarnings("unused")
  public static SparkSQLPushDownFilter parseFrom(final byte[] pbBytes)
          throws DeserializationException {
    SparkFilterProtos.SQLPredicatePushDownFilter proto;
    try {
      proto = SparkFilterProtos.SQLPredicatePushDownFilter.parseFrom(pbBytes);
    } catch (InvalidProtocolBufferException e) {
      throw new DeserializationException(e);
    }
    String encoder = proto.getEncoderClassName();
    BytesEncoder enc = JavaBytesEncoder$.MODULE$.create(encoder);
    DynamicLogicExpression dynamicLogicExpression =
            DynamicLogicExpressionBuilder.build(proto.getDynamicLogicExpression(), enc);
    final List<ByteString> valueFromQueryArrayList = proto.getValueFromQueryArrayList();
    byte[][] valueFromQueryArray = new byte[valueFromQueryArrayList.size()][];
    for (int i = 0; i < valueFromQueryArrayList.size(); i++) {
      valueFromQueryArray[i] = valueFromQueryArrayList.get(i).toByteArray();
    }
    HashMap<ByteArrayComparable, HashMap<ByteArrayComparable, String>>
            currentCellToColumnIndexMap = new HashMap<>();
    for (SparkFilterProtos.SQLPredicatePushDownCellToColumnMapping
            sqlPredicatePushDownCellToColumnMapping :
            proto.getCellToColumnMappingList()) {
      byte[] familyArray =
              sqlPredicatePushDownCellToColumnMapping.getColumnFamily().toByteArray();
      ByteArrayComparable familyByteComparable =
              new ByteArrayComparable(familyArray, 0, familyArray.length);
      HashMap<ByteArrayComparable, String> qualifierMap =
              currentCellToColumnIndexMap.get(familyByteComparable);
      if (qualifierMap == null) {
        qualifierMap = new HashMap<>();
        currentCellToColumnIndexMap.put(familyByteComparable, qualifierMap);
      }
      byte[] qualifierArray =
              sqlPredicatePushDownCellToColumnMapping.getQualifier().toByteArray();
      ByteArrayComparable qualifierByteComparable =
              new ByteArrayComparable(qualifierArray, 0 ,qualifierArray.length);
      qualifierMap.put(qualifierByteComparable,
              sqlPredicatePushDownCellToColumnMapping.getColumnName());
    }
    return new SparkSQLPushDownFilter(dynamicLogicExpression,
            valueFromQueryArray, currentCellToColumnIndexMap, encoder);
  }
@ SuppressWarnings ( "unused" ) public static SparkSQLPushDownFilter parseFrom ( final byte [ ] pbBytes ) throws DeserializationException { SparkFilterProtos . SQLPredicatePushDownFilter proto ; try { proto = SparkFilterProtos . SQLPredicatePushDownFilter . parseFrom ( pbBytes ) ; } catch ( InvalidProtocolBufferException e ) { throw new DeserializationException ( e ) ; } String encoder = proto . getEncoderClassName ( ) ; BytesEncoder enc = JavaBytesEncoder$ . MODULE$ . create ( encoder ) ; DynamicLogicExpression dynamicLogicExpression = DynamicLogicExpressionBuilder . build ( proto . getDynamicLogicExpression ( ) , enc ) ; final List < ByteString > valueFromQueryArrayList = proto . getValueFromQueryArrayList ( ) ; byte [ ] [ ] valueFromQueryArray = new byte [ valueFromQueryArrayList . size ( ) ] [ ] ; for ( int i = 0 ; i < valueFromQueryArrayList . size ( ) ; i ++ ) { valueFromQueryArray [ i ] = valueFromQueryArrayList . get ( i ) . toByteArray ( ) ; } HashMap < ByteArrayComparable , HashMap < ByteArrayComparable , String > > currentCellToColumnIndexMap = new HashMap < > ( ) ; for ( SparkFilterProtos . SQLPredicatePushDownCellToColumnMapping sqlPredicatePushDownCellToColumnMapping : proto . getCellToColumnMappingList ( ) ) { byte [ ] familyArray = sqlPredicatePushDownCellToColumnMapping . getColumnFamily ( ) . toByteArray ( ) ; ByteArrayComparable familyByteComparable = new ByteArrayComparable ( familyArray , 0 , familyArray . length ) ; HashMap < ByteArrayComparable , String > qualifierMap = currentCellToColumnIndexMap . get ( familyByteComparable ) ; if ( qualifierMap == null ) { qualifierMap = new HashMap < > ( ) ; currentCellToColumnIndexMap . put ( familyByteComparable , qualifierMap ) ; } byte [ ] qualifierArray = sqlPredicatePushDownCellToColumnMapping . getQualifier ( ) . toByteArray ( ) ; ByteArrayComparable qualifierByteComparable = new ByteArrayComparable ( qualifierArray , 0 , qualifierArray . length ) ; qualifierMap . put ( qualifierByteComparable , sqlPredicatePushDownCellToColumnMapping . getColumnName ( ) ) ; } return new SparkSQLPushDownFilter ( dynamicLogicExpression , valueFromQueryArray , currentCellToColumnIndexMap , encoder ) ; }
@param pbBytes A pb serialized instance
 @return An instance of SparkSQLPushDownFilter
 @throws org.apache.hadoop.hbase.exceptions.DeserializationException
@param pbBytes A pb serialized instance @return An instance of SparkSQLPushDownFilter @throws org . apache . hadoop . hbase . exceptions . DeserializationException
//Load DynamicLogicExpression //Load valuesFromQuery //Load mapping from HBase family/qualifier to Spark SQL columnName