return new Text(Coordinate.of(table, id).toString());
/** * Read the next row from the split, storing the coordinate in "key" and the content in "value". If there are no * more rows then false is returned and "key" and "value" are not modified. * @return true if a row was read, false if there were no more rows */ public boolean setNextKeyValue(Text key, Row value) throws IOException { if (!_rows.hasNext()) { Closeables.close(this, true); return false; } try { Map<String, Object> content = _rows.next(); key.set(Coordinate.fromJson(content).toString()); value.set(content); _rowsRead += 1; } catch (Exception e) { for (Throwable cause : Throwables.getCausalChain(e)) { Throwables.propagateIfInstanceOf(cause, IOException.class); } throw new IOException("Failed to read next row", e); } return true; }
/** * Read the next row from the split, storing the coordinate in "key" and the content in "value". If there are no * more rows then false is returned and "key" and "value" are not modified. * @return true if a row was read, false if there were no more rows */ public boolean setNextKeyValue(Text key, Row value) throws IOException { if (!_rows.hasNext()) { Closeables.close(this, true); return false; } try { Map<String, Object> content = _rows.next(); key.set(Coordinate.fromJson(content).toString()); value.set(content); _rowsRead += 1; } catch (Exception e) { for (Throwable cause : Throwables.getCausalChain(e)) { Throwables.propagateIfInstanceOf(cause, IOException.class); } throw new IOException("Failed to read next row", e); } return true; }
@Override public Iterator<Map<String, Object>> multiGet(String apiKey, final List<Coordinate> coordinates, ReadConsistency consistency) { checkNotNull(coordinates, "coordinates"); checkNotNull(consistency, "consistency"); try { UriBuilder uriBuilder = _dataStore.clone().segment("_multiget").queryParam("consistency", consistency); for(Coordinate coordinate : coordinates) { uriBuilder.queryParam("id", coordinate.toString()); } URI uri = uriBuilder.build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(new TypeReference<Iterator<Map<String,Object>>>(){}); } catch (EmoClientException e) { throw convertException(e); } }
@Override public Iterator<Map<String, Object>> multiGet(String apiKey, final List<Coordinate> coordinates, ReadConsistency consistency) { checkNotNull(coordinates, "coordinates"); checkNotNull(consistency, "consistency"); try { UriBuilder uriBuilder = _dataStore.clone().segment("_multiget").queryParam("consistency", consistency); for(Coordinate coordinate : coordinates) { uriBuilder.queryParam("id", coordinate.toString()); } URI uri = uriBuilder.build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(new TypeReference<Iterator<Map<String,Object>>>(){}); } catch (EmoClientException e) { throw convertException(e); } }