Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-8866

Implement RegEx support for Column Qualifiers etc. in Thrift

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • Thrift
    • Thrift Thrift2

    Description

      In the Thrift 1 definition file it says:

        /** 
         * Get a scanner on the current table starting at the specified row and
         * ending at the last row in the table.  Return the specified columns.
         *
         * @return scanner id to be used with other scanner procedures
         */
        ScannerID scannerOpen(
          /** name of table */
          1:Text tableName,
      
          /**
           * Starting row in table to scan.
           * Send "" (empty string) to start at the first row.
           */
          2:Text startRow,
      
          /**
           * columns to scan. If column name is a column family, all
           * columns of the specified column family are returned. It's also possible
           * to pass a regex in the column qualifier.
           */
          3:list<Text> columns,
      
          /** Scan attributes */
          4:map<Text, Text> attributes
        ) throws (1:IOError io)
      

      Especially that "columns" can contain a regex for the qualifier. The code though does not support that currently:

          @Override
          public int scannerOpen(ByteBuffer tableName, ByteBuffer startRow,
              List<ByteBuffer> columns,
              Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
            try {
              HTable table = getTable(tableName);
              Scan scan = new Scan(getBytes(startRow));
              addAttributes(scan, attributes);
              if(columns != null && columns.size() != 0) {
                for(ByteBuffer column : columns) {
                  byte [][] famQf = KeyValue.parseColumn(getBytes(column));
                  if(famQf.length == 1) {
                    scan.addFamily(famQf[0]);
                  } else {
                    scan.addColumn(famQf[0], famQf[1]);
                  }
                }
              }
              return addScanner(table.getScanner(scan));
            } catch (IOException e) {
              LOG.warn(e.getMessage(), e);
              throw new IOError(e.getMessage());
            }
          }
      

      It parses the columns as literals, and sets up the Scan without supporting the appropriate QualifierFilter (or others) with RegexStringComparator.

      Attachments

        Activity

          People

            Unassigned Unassigned
            larsgeorge Lars George
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: