@Override
 public Row get() {
   if (row == null) {
     if (searchRow != null) {
       Result r;
       try {
         Get get = new Get(HBaseUtils.toBytes(searchRow.getRowKey()));
         get.setTimeStamp(searchTimestamp);
         if (columns != null) {
           for (Column c : columns) {
             if (c.isRowKeyColumn()) continue;
             else if (c.getColumnFamilyName() != null)
               get.addColumn(c.getColumnFamilyNameAsBytes(), c.getNameAsBytes());
             else get.addColumn(defaultColumnFamilyName, c.getNameAsBytes());
           }
         }
         r = secondaryIndex.dataTable.get(get);
       } catch (IOException e) {
         throw DbException.convert(e);
       }
       if (r != null) {
         Value[] data = new Value[columns.size()];
         Value rowKey = ValueString.get(Bytes.toString(r.getRow()));
         if (columns != null) {
           int i = 0;
           for (Column c : columns) {
             i = c.getColumnId();
             if (c.isRowKeyColumn()) data[i] = rowKey;
             else
               data[i] =
                   HBaseUtils.toValue( //
                       r.getValue(c.getColumnFamilyNameAsBytes(), c.getNameAsBytes()),
                       c.getType());
           }
         }
         row = new HBaseRow(null, rowKey, data, Row.MEMORY_CALCULATE, r);
       }
     }
   }
   return row;
 }
Beispiel #2
0
 public Value getTransactionId() {
   if (undoLog.size() == 0 || !database.isPersistent()) {
     return ValueNull.INSTANCE;
   }
   return ValueString.get(firstUncommittedLog + "-" + firstUncommittedPos + "-" + id);
 }