static Get toCheckExistenceOnly(Get get) { if (get.isCheckExistenceOnly()) { return get; } return ReflectionUtils.newInstance(get.getClass(), get).setCheckExistenceOnly(true); }
@Override public boolean[] exists(List<Get> gets) throws IOException { if (gets.isEmpty()) return new boolean[]{}; if (gets.size() == 1) return new boolean[]{exists(gets.get(0))}; ArrayList<Get> exists = new ArrayList<>(gets.size()); for (Get g: gets){ Get ge = new Get(g); ge.setCheckExistenceOnly(true); exists.add(ge); } Object[] r1= new Object[exists.size()]; try { batch(exists, r1, readRpcTimeoutMs); } catch (InterruptedException e) { throw (InterruptedIOException)new InterruptedIOException().initCause(e); } // translate. boolean[] results = new boolean[r1.length]; int i = 0; for (Object o : r1) { // batch ensures if there is a failure we get an exception instead results[i++] = ((Result)o).getExists(); } return results; }
private Result internalGetFromHTable(Table table, String path, boolean fetchContent, boolean fetchTimestamp) throws IOException { byte[] rowkey = Bytes.toBytes(path); Get get = new Get(rowkey); if (!fetchContent && !fetchTimestamp) { get.setCheckExistenceOnly(true); } else { if (fetchContent) get.addColumn(B_FAMILY, B_COLUMN); if (fetchTimestamp) get.addColumn(B_FAMILY, B_COLUMN_TS); } Result result = table.get(get); boolean exists = result != null && (!result.isEmpty() || (result.getExists() != null && result.getExists())); return exists ? result : null; }
g.setCheckExistenceOnly(true); r = table.get(g); Assert.assertFalse(r.isStale()); g.setCheckExistenceOnly(true); g.setConsistency(Consistency.TIMELINE); r = table.get(g); g.setCheckExistenceOnly(true); g.setConsistency(Consistency.TIMELINE); r = table.get(g);
g.setCheckExistenceOnly(true); g.setConsistency(Consistency.TIMELINE); gets.add(g); g = new Get(b2); g.setCheckExistenceOnly(true); g.setConsistency(Consistency.TIMELINE); gets.add(g);
get.setCheckExistenceOnly(checkExistenceOnly); if (get.getConsistency() == null){ get.setConsistency(DEFAULT_CONSISTENCY);
get.setCheckExistenceOnly(true);
static Get toCheckExistenceOnly(Get get) { if (get.isCheckExistenceOnly()) { return get; } return ReflectionUtils.newInstance(get.getClass(), get).setCheckExistenceOnly(true); }
@Override public boolean[] exists(List<Get> gets) throws IOException { if (gets.isEmpty()) return new boolean[]{}; if (gets.size() == 1) return new boolean[]{exists(gets.get(0))}; ArrayList<Get> exists = new ArrayList<>(gets.size()); for (Get g: gets){ Get ge = new Get(g); ge.setCheckExistenceOnly(true); exists.add(ge); } Object[] r1= new Object[exists.size()]; try { batch(exists, r1, readRpcTimeoutMs); } catch (InterruptedException e) { throw (InterruptedIOException)new InterruptedIOException().initCause(e); } // translate. boolean[] results = new boolean[r1.length]; int i = 0; for (Object o : r1) { // batch ensures if there is a failure we get an exception instead results[i++] = ((Result)o).getExists(); } return results; }
out.setCheckExistenceOnly(in.isExistence_only());
get1.setCheckExistenceOnly(true); get2.setCheckExistenceOnly(true); Result result2 = table.get(get2); get3.setCheckExistenceOnly(true); Result result3 = table.get(get3); get4.addColumn(Bytes.toBytes("colfam1"), Bytes.toBytes("qual9999")); // co GetCheckExistenceExample-6-Get4 Check for an existent, and non-existent column. get4.addColumn(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1")); get4.setCheckExistenceOnly(true); Result result4 = table.get(get4);
get.setReplicaId(2); get.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED); get.setCheckExistenceOnly(true); get.setTimeRange(3, 4); get.setMaxVersions(11);
get.setCheckExistenceOnly(true);
@Override public GetBuilder setCheckExistenceOnly(boolean checkExistenceOnly) { get.setCheckExistenceOnly(checkExistenceOnly); return this; }
@Override public GetBuilder setCheckExistenceOnly(boolean checkExistenceOnly) { get.setCheckExistenceOnly(checkExistenceOnly); return this; }
@Override public GetBuilder setCheckExistenceOnly(boolean checkExistenceOnly) { get.setCheckExistenceOnly(checkExistenceOnly); return this; }
get.setCheckExistenceOnly(checkExistenceOnly); if (get.getConsistency() == null){ get.setConsistency(DEFAULT_CONSISTENCY);
get.setReplicaId(2); get.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED); get.setCheckExistenceOnly(true); get.setTimeRange(3, 4); get.setMaxVersions(11);