/** {@inheritDoc} */ @Override public List<FijiRowData> bulkGet(List<EntityId> entityIds, FijiDataRequest dataRequest) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot get rows from FijiTableReader instance %s in state %s.", this, state); // Bulk gets have some overhead associated with them, // so delegate work to get(EntityId, FijiDataRequest) if possible. if (entityIds.size() == 1) { return Collections.singletonList(this.get(entityIds.get(0), dataRequest)); } final ReaderLayoutCapsule capsule = mReaderLayoutCapsule; final FijiTableLayout tableLayout = capsule.getLayout(); validateRequestAgainstLayout(dataRequest, tableLayout); final HBaseDataRequestAdapter hbaseRequestAdapter = new HBaseDataRequestAdapter(dataRequest, capsule.getColumnNameTranslator()); // Construct a list of hbase Gets to send to the HTable. final List<Get> hbaseGetList = makeGetList(entityIds, tableLayout, hbaseRequestAdapter); // Send the HTable Gets. final Result[] results = doHBaseGet(hbaseGetList); Preconditions.checkState(entityIds.size() == results.length); // Parse the results. If a Result is null, then the corresponding FijiRowData should also // be null. This indicates that there was an error retrieving this row. return parseResults(results, entityIds, dataRequest); }
final Result[] results = doHBaseGet(hbaseGetList); Preconditions.checkState(entityIds.size() == results.length);
/** {@inheritDoc} */ @Override public FijiRowData get(EntityId entityId, FijiDataRequest dataRequest) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot get row from FijiTableReader instance %s in state %s.", this, state); final ReaderLayoutCapsule capsule = mReaderLayoutCapsule; // Make sure the request validates against the layout of the table. final FijiTableLayout tableLayout = capsule.getLayout(); validateRequestAgainstLayout(dataRequest, tableLayout); // Construct an HBase Get to send to the HTable. HBaseDataRequestAdapter hbaseRequestAdapter = new HBaseDataRequestAdapter(dataRequest, capsule.getColumnNameTranslator()); Get hbaseGet; try { hbaseGet = hbaseRequestAdapter.toGet(entityId, tableLayout); } catch (InvalidLayoutException e) { // The table layout should never be invalid at this point, since we got it from a valid // opened table. If it is, there's something seriously wrong. throw new InternalFijiError(e); } // Send the HTable Get. final Result result = hbaseGet.hasFamilies() ? doHBaseGet(hbaseGet) : new Result(); // Parse the result. return new HBaseFijiRowData( mTable, dataRequest, entityId, result, capsule.getCellDecoderProvider()); }
new HBaseDataRequestAdapter(dataRequest, capsule.getColumnNameTranslator()); final Get get = hbaseDataRequestAdapter.toGet(entityId, tableLayout); final Result result = get.hasFamilies() ? doHBaseGet(get) : new Result(); return HBaseFijiResult.create( entityId,