external/spark-hbase-connector/src/main/java/org/apache/hadoop/hbase/spark/SparkSQLPushDownFilter.java
/**
   * @return The filter serialized using pb
   */
@return The filter serialized using pb
@return The filter serialized using pb
public byte[] toByteArray() {
    SparkFilterProtos.SQLPredicatePushDownFilter.Builder builder =
            SparkFilterProtos.SQLPredicatePushDownFilter.newBuilder();
    SparkFilterProtos.SQLPredicatePushDownCellToColumnMapping.Builder columnMappingBuilder =
            SparkFilterProtos.SQLPredicatePushDownCellToColumnMapping.newBuilder();
    builder.setDynamicLogicExpression(dynamicLogicExpression.toExpressionString());
    for (byte[] valueFromQuery: valueFromQueryArray) {
      builder.addValueFromQueryArray(ByteStringer.wrap(valueFromQuery));
    }
    for (Map.Entry<ByteArrayComparable, HashMap<ByteArrayComparable, String>>
            familyEntry : currentCellToColumnIndexMap.entrySet()) {
      for (Map.Entry<ByteArrayComparable, String> qualifierEntry :
              familyEntry.getValue().entrySet()) {
        columnMappingBuilder.setColumnFamily(
                ByteStringer.wrap(familyEntry.getKey().bytes()));
        columnMappingBuilder.setQualifier(
                ByteStringer.wrap(qualifierEntry.getKey().bytes()));
        columnMappingBuilder.setColumnName(qualifierEntry.getValue());
        builder.addCellToColumnMapping(columnMappingBuilder.build());
      }
    }
    builder.setEncoderClassName(encoderClassName);
    return builder.build().toByteArray();
  }
public byte [ ] toByteArray ( ) { SparkFilterProtos . SQLPredicatePushDownFilter . Builder builder = SparkFilterProtos . SQLPredicatePushDownFilter . newBuilder ( ) ; SparkFilterProtos . SQLPredicatePushDownCellToColumnMapping . Builder columnMappingBuilder = SparkFilterProtos . SQLPredicatePushDownCellToColumnMapping . newBuilder ( ) ; builder . setDynamicLogicExpression ( dynamicLogicExpression . toExpressionString ( ) ) ; for ( byte [ ] valueFromQuery : valueFromQueryArray ) { builder . addValueFromQueryArray ( ByteStringer . wrap ( valueFromQuery ) ) ; } for ( Map . Entry < ByteArrayComparable , HashMap < ByteArrayComparable , String > > familyEntry : currentCellToColumnIndexMap . entrySet ( ) ) { for ( Map . Entry < ByteArrayComparable , String > qualifierEntry : familyEntry . getValue ( ) . entrySet ( ) ) { columnMappingBuilder . setColumnFamily ( ByteStringer . wrap ( familyEntry . getKey ( ) . bytes ( ) ) ) ; columnMappingBuilder . setQualifier ( ByteStringer . wrap ( qualifierEntry . getKey ( ) . bytes ( ) ) ) ; columnMappingBuilder . setColumnName ( qualifierEntry . getValue ( ) ) ; builder . addCellToColumnMapping ( columnMappingBuilder . build ( ) ) ; } } builder . setEncoderClassName ( encoderClassName ) ; return builder . build ( ) . toByteArray ( ) ; }
@return The filter serialized using pb
@return The filter serialized using pb