@Override public Result[] get(List<Get> gets) throws IOException { return table.get(gets); }
Result result = hTable.get(g);
@Override public Result[] get(List<Get> gets) throws IOException { return table.get(gets); }
@Override public Result[] get(List<Get> gets) throws IOException { return table.get(gets); }
r = hTable.get(g); } catch (IOException e) { System.err.println("Error doing get: " + e);
/** * Submit all queued Gets. * * @return The Result of each queued Get. */ public Result[] getAll() { try { Result[] results = table.get(gets); gets.clear(); return results; } catch (Exception e) { LOG.warn("Could not perform HBase lookup.", e); throw new RuntimeException(e); } }
@SuppressWarnings({ "rawtypes", "deprecation" }) protected Map getCIFObject(String key) { LOGGER.debug("=======Pinging HBase For: {}", key); Get get = new Get(key.getBytes()); Result rs; Map output = new HashMap(); try { rs = table.get(get); for (KeyValue kv : rs.raw()) output.put(new String(kv.getQualifier()), "Y"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return output; }
private Result getResult(String user) throws IOException { byte[] rowKey = Bytes.toBytes(user); Get get = new Get(rowKey); get.addFamily(cf); return getTableInterface().get(get); }
Result r = hTable.get(g);
@Override public Iterable<Document> getAllLatest( List<GetRequest> getRequests) throws IOException { List<Get> gets = new ArrayList<>(); for (GetRequest getRequest: getRequests) { gets.add(buildGet(getRequest)); } Result[] results = getTableInterface().get(gets); List<Document> allLatest = new ArrayList<>(); for (Result result: results) { Document d = getDocumentFromResult(result); if (d != null) { allLatest.add(d); } } return allLatest; }
@Override public Iterable<LookupKV<EnrichmentKey, EnrichmentValue>> get( Iterable<KeyWithContext<EnrichmentKey, HBaseContext>> keys , boolean logAccess ) throws IOException { if(Iterables.isEmpty(keys)) { return Collections.emptyList(); } HTableInterface table = Iterables.getFirst(keys, null).getContext().getTable(); List<LookupKV<EnrichmentKey, EnrichmentValue>> ret = new ArrayList<>(); Iterator<KeyWithContext<EnrichmentKey, HBaseContext>> keyWithContextIterator = keys.iterator(); for(Result result : table.get(keysToGets(keys))) { HBaseContext context = keyWithContextIterator.next().getContext(); ret.add(converter.fromResult(result, getColumnFamily(context))); } return ret; }
Result[] results = table.get(gets); for(int i = 0; i < results.length; ++i) { Result result = results[i];
@Override public synchronized Document getLatest(String guid, String sensorType) throws IOException { Key k = new Key(guid, sensorType); Get get = new Get(Key.toBytes(k)); get.addFamily(cf); Result result = getTableInterface().get(get); return getDocumentFromResult(result); }
Result[] rawResult = hTable.get(getRequest);
@Test public void shouldFindOne() throws Exception { Result result = mock(Result.class); when(result.getValue(cf, Bytes.toBytes("type"))).thenReturn("userSettings1String".getBytes()); Get get = new Get("user1".getBytes()); get.addFamily(cf); when(userSettingsTable.get(get)).thenReturn(result); UserSettingsClient userSettingsClient = new UserSettingsClient(userSettingsTable, cf); Assert.assertEquals("userSettings1String", userSettingsClient.findOne("user1", "type").get()); assertFalse(userSettingsClient.findOne("missingUser", "type").isPresent()); }
@Override public LookupKV<EnrichmentKey, EnrichmentValue> get(EnrichmentKey key, HBaseContext context, boolean logAccess) throws IOException { return converter.fromResult(context.getTable().get(converter.toGet(getColumnFamily(context), key)), getColumnFamily(context)); }
Result r = hTable.get(new Get(bKey)); assertFalse(r.isEmpty()); } finally {
@Override public Result runWith(HTableInterface hTable) throws IOException { return hTable.get(get); } });
@Override public Result get(Get get) throws IOException { if (tx == null) { throw new IOException("Transaction not started"); } return hTable.get(transactionalizeAction(get)); }
/** * Fetches a schema entry from the tables given a schema ID. * * @param schemaId schema ID * @return Avro schema entry, or null if the schema ID does not exist in the table * @throws IOException on I/O error. */ private SchemaTableEntry loadFromIdTable(long schemaId) throws IOException { final Get get = new Get(longToVarInt64(schemaId)); final Result result = mSchemaIdTable.get(get); return result.isEmpty() ? null : decodeSchemaEntry(result.value()); }