本文整理了Java中org.apache.hadoop.hbase.client.Get.setTimeStamp()
方法的一些代码示例,展示了Get.setTimeStamp()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Get.setTimeStamp()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Get
类名称:Get
方法名:setTimeStamp
[英]Get versions of columns with the specified timestamp.
[中]获取具有指定时间戳的列的版本。
代码示例来源:origin: larsgeorge/hbase-book
.setId("GetFluentExample")
.setMaxVersions()
.setTimeStamp(1)
.addColumn(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"))
.addFamily(Bytes.toBytes("colfam2"));
代码示例来源:origin: cdapio/cdap
@Override
public GetBuilder setTimeStamp(long timestamp) throws IOException {
get.setTimeStamp(timestamp);
return this;
}
代码示例来源:origin: co.cask.cdap/cdap-hbase-compat-base
@Override
public GetBuilder setTimeStamp(long timestamp) throws IOException {
get.setTimeStamp(timestamp);
return this;
}
代码示例来源:origin: co.cask.hbase/hbase
static public Get agetToGet(AGet aget) throws IOException {
Get get = new Get(Bytes.toBytes(aget.row));
if (aget.columns != null) {
for (AColumn acolumn : aget.columns) {
if (acolumn.qualifier != null) {
get.addColumn(Bytes.toBytes(acolumn.family), Bytes.toBytes(acolumn.qualifier));
} else {
get.addFamily(Bytes.toBytes(acolumn.family));
}
}
}
if (aget.timestamp != null) {
get.setTimeStamp(aget.timestamp);
}
if (aget.timerange != null) {
get.setTimeRange(aget.timerange.minStamp, aget.timerange.maxStamp);
}
if (aget.maxVersions != null) {
get.setMaxVersions(aget.maxVersions);
}
return get;
}
代码示例来源:origin: org.apache.omid/hbase-common
/**
* Returns true if the particular cell passed exists in the datastore.
* @return true if the cell specified exists. false otherwise
* @throws IOException
*/
public static boolean hasCell(byte[] row,
byte[] family,
byte[] qualifier,
long version,
CellGetter cellGetter)
throws IOException {
Get get = new Get(row);
get.addColumn(family, qualifier);
get.setTimeStamp(version);
Result result = cellGetter.get(get);
return result.containsColumn(family, qualifier);
}
代码示例来源:origin: com.yahoo.omid/hbase-common
/**
* Returns true if the particular cell passed exists in the datastore.
* @return true if the cell specified exists. false otherwise
* @throws IOException
*/
public static boolean hasCell(byte[] row,
byte[] family,
byte[] qualifier,
long version,
CellGetter cellGetter)
throws IOException {
Get get = new Get(row);
get.addColumn(family, qualifier);
get.setTimeStamp(version);
Result result = cellGetter.get(get);
return result.containsColumn(family, qualifier);
}
代码示例来源:origin: jrkinley/storm-hbase
g.setTimeStamp(ts);
代码示例来源:origin: lintool/warcbase
public void writeContent(HttpServletResponse resp, String tableName, String url, String date14digit)
throws IOException {
String key = UrlUtils.urlToKey(url);
HTableInterface table = hbaseConnection.getTable(tableName);
Get get = new Get(Bytes.toBytes(key));
try {
get.setTimeStamp(ArchiveUtils.parse14DigitDate(date14digit).getTime());
} catch (ParseException e) {
e.printStackTrace();
}
Result result = table.get(get);
Cell[] cells = result.rawCells();
if (cells.length == 1) {
// We should have exactly one result here...
byte[] data = CellUtil.cloneValue(cells[0]);
String type = Bytes.toString(CellUtil.cloneQualifier(cells[0]));
LOG.info("Fetching " + key + " at " + date14digit);
resp.setHeader("Content-Type", type);
resp.setContentLength(data.length);
resp.getOutputStream().write(data);
}
table.close();
}
}
代码示例来源:origin: org.apache.omid/omid-hbase-common-hbase1.x
/**
* Returns true if the particular cell passed exists in the datastore.
* @param row row
* @param family column family
* @param qualifier columnn name
* @param version version
* @param cellGetter an instance of CellGetter
* @return true if the cell specified exists. false otherwise
* @throws IOException
*/
public static boolean hasCell(byte[] row,
byte[] family,
byte[] qualifier,
long version,
CellGetter cellGetter)
throws IOException {
Get get = new Get(row);
get.addColumn(family, qualifier);
get.setTimeStamp(version);
Result result = cellGetter.get(get);
return result.containsColumn(family, qualifier);
}
代码示例来源:origin: org.apache.omid/hbase-client
@Override
public Optional<Long> readCommitTimestampFromShadowCell(long startTimestamp) throws IOException {
Get get = new Get(hBaseCellId.getRow());
byte[] family = hBaseCellId.getFamily();
byte[] shadowCellQualifier = CellUtils.addShadowCellSuffix(hBaseCellId.getQualifier());
get.addColumn(family, shadowCellQualifier);
get.setMaxVersions(1);
get.setTimeStamp(startTimestamp);
Result result = hBaseCellId.getTable().get(get);
if (result.containsColumn(family, shadowCellQualifier)) {
return Optional.of(Bytes.toLong(result.getValue(family, shadowCellQualifier)));
}
return Optional.absent();
}
代码示例来源:origin: XiaoMi/themis
protected byte[] readLockBytes(HRegion region, byte[] row, Integer lid, Column column,
long prewriteTs, MetricsTimeVaryingRate latency) throws IOException {
Column lockColumn = ColumnUtil.getLockColumn(column);
Get get = new Get(row).addColumn(lockColumn.getFamily(), lockColumn.getQualifier());
get.setTimeStamp(prewriteTs);
Result result = getFromRegion(region, get, lid, latency);
return result.isEmpty() ? null : result.list().get(0).getValue();
}
代码示例来源:origin: domino-succ/domino
@SuppressWarnings("deprecation")
@Override
public void rollbackRow(byte[] row, long startId, Integer lockId)
throws IOException {
byte[] family = DominoConst.INNER_FAMILY;
Get get = new Get(row);
get.setTimeStamp(startId);
get.addFamily(family);
Result r = region.get(get, lockId);
if (r == null || r.isEmpty()) return;
byte[] colBytes = r.getValue(family, DominoConst.COLUMNS_COL);
if (colBytes == null || colBytes.length == 0) return;
Delete del = new Delete(row);
Columns cols = new Columns(colBytes);
for (Column col : cols.cols) {
del.deleteColumn(col.family, col.qualifier, startId);
}
del.deleteColumn(family, DominoConst.COLUMNS_COL, startId);
del.deleteColumn(family, DominoConst.STATUS_COL, startId);
mutateRow(del, lockId);
}
代码示例来源:origin: domino-succ/domino
Columns prevCols = new Columns(DominoConst.getColumnsAt(r, prevStartId));
Get get = new Get(row);
get.setTimeStamp(removeStartId);
Result res = region.get(get, lockId);
for (Column col : removeCols.cols) {
代码示例来源:origin: XiaoMi/themis
protected boolean hasLock(ThemisLock lock) throws IOException {
ColumnCoordinate columnCoordinate = lock.getColumn();
Column lc = ColumnUtil.getLockColumn(columnCoordinate);
HTableInterface table = null;
try {
table = conn.getTable(columnCoordinate.getTableName());
Get get = new Get(columnCoordinate.getRow()).addColumn(lc.getFamily(), lc.getQualifier());
get.setTimeStamp(lock.getTimestamp());
return !table.get(get).isEmpty();
} finally {
closeTable(table);
}
}
}
代码示例来源:origin: com.argonio.gora/gora-hbase
private void addTimeRange(Get get, Query<K, T> query) throws IOException {
if(query.getStartTime() > 0 || query.getEndTime() > 0) {
if(query.getStartTime() == query.getEndTime()) {
get.setTimeStamp(query.getStartTime());
} else {
long startTime = query.getStartTime() > 0 ? query.getStartTime() : 0;
long endTime = query.getEndTime() > 0 ? query.getEndTime() : Long.MAX_VALUE;
get.setTimeRange(startTime, endTime);
}
}
}
代码示例来源:origin: apache/gora
private void addTimeRange(Get get, Query<K, T> query) throws IOException {
if(query.getStartTime() > 0 || query.getEndTime() > 0) {
if(query.getStartTime() == query.getEndTime()) {
get.setTimeStamp(query.getStartTime());
} else {
long startTime = query.getStartTime() > 0 ? query.getStartTime() : 0;
long endTime = query.getEndTime() > 0 ? query.getEndTime() : Long.MAX_VALUE;
get.setTimeRange(startTime, endTime);
}
}
}
代码示例来源:origin: XiaoMi/themis
protected Result readData(ColumnCoordinate c, long ts) throws IOException {
Get get = new Get(c.getRow()).addColumn(c.getFamily(), c.getQualifier());
get.setTimeStamp(ts);
Result result = getTable(c.getTableName()).get(get);
return result;
}
代码示例来源:origin: co.cask.hbase/hbase
out.setTimeStamp(in.getTimestamp());
} else if (in.isSetTimeRange()) {
out.setTimeRange(in.getTimeRange().getMinStamp(), in.getTimeRange().getMaxStamp());
内容来源于网络,如有侵权,请联系作者删除!