/** * Converts multiple {@link TGet}s (Thrift) into a list of {@link Get}s (HBase). * * @param in list of <code>TGet</code>s to convert * * @return list of <code>Get</code> objects * * @throws IOException if an invalid time range or max version parameter is given * @see #getFromThrift(TGet) */ public static List<Get> getsFromThrift(List<TGet> in) throws IOException { List<Get> out = new ArrayList<>(in.size()); for (TGet get : in) { out.add(getFromThrift(get)); } return out; }
@Override public boolean exists(ByteBuffer table, TGet get) throws TIOError, TException { Table htable = getTable(table); try { return htable.exists(getFromThrift(get)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public TResult get(ByteBuffer table, TGet get) throws TIOError, TException { Table htable = getTable(table); try { return resultFromHBase(htable.get(getFromThrift(get))); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
Get get = getFromThrift(tGet); assertArrayEquals(get.getAttribute("attribute1"), attributeValue);
@Test public void testConsistency() throws Exception { byte[] rowName = Bytes.toBytes("testConsistency"); TGet tGet = new TGet(wrap(rowName)); tGet.setConsistency(TConsistency.STRONG); Get get = getFromThrift(tGet); assertEquals(Consistency.STRONG, get.getConsistency()); tGet.setConsistency(TConsistency.TIMELINE); tGet.setTargetReplicaId(1); get = getFromThrift(tGet); assertEquals(Consistency.TIMELINE, get.getConsistency()); assertEquals(1, get.getReplicaId()); TScan tScan = new TScan(); tScan.setConsistency(TConsistency.STRONG); Scan scan = scanFromThrift(tScan); assertEquals(Consistency.STRONG, scan.getConsistency()); tScan.setConsistency(TConsistency.TIMELINE); tScan.setTargetReplicaId(1); scan = scanFromThrift(tScan); assertEquals(Consistency.TIMELINE, scan.getConsistency()); assertEquals(1, scan.getReplicaId()); TResult tResult = new TResult(); assertFalse(tResult.isSetStale()); tResult.setStale(true); assertTrue(tResult.isSetStale()); }
/** * Converts multiple {@link TGet}s (Thrift) into a list of {@link Get}s (HBase). * * @param in list of <code>TGet</code>s to convert * * @return list of <code>Get</code> objects * * @throws IOException if an invalid time range or max version parameter is given * @see #getFromThrift(TGet) */ public static List<Get> getsFromThrift(List<TGet> in) throws IOException { List<Get> out = new ArrayList<Get>(in.size()); for (TGet get : in) { out.add(getFromThrift(get)); } return out; }
/** * Converts multiple {@link TGet}s (Thrift) into a list of {@link Get}s (HBase). * * @param in list of <code>TGet</code>s to convert * * @return list of <code>Get</code> objects * * @throws IOException if an invalid time range or max version parameter is given * @see #getFromThrift(TGet) */ public static List<Get> getsFromThrift(List<TGet> in) throws IOException { List<Get> out = new ArrayList<>(in.size()); for (TGet get : in) { out.add(getFromThrift(get)); } return out; }
/** * Converts multiple {@link TGet}s (Thrift) into a list of {@link Get}s (HBase). * * @param in list of <code>TGet</code>s to convert * * @return list of <code>Get</code> objects * * @throws IOException if an invalid time range or max version parameter is given * @see #getFromThrift(TGet) */ public static List<Get> getsFromThrift(List<TGet> in) throws IOException { List<Get> out = new ArrayList<>(in.size()); for (TGet get : in) { out.add(getFromThrift(get)); } return out; }
@Override public boolean exists(ByteBuffer table, TGet get) throws TIOError, TException { HTableInterface htable = getTable(table.array()); try { return htable.exists(getFromThrift(get)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public TResult get(ByteBuffer table, TGet get) throws TIOError, TException { HTableInterface htable = getTable(table.array()); try { return resultFromHBase(htable.get(getFromThrift(get))); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public boolean exists(ByteBuffer table, TGet get) throws TIOError, TException { Table htable = getTable(table); try { return htable.exists(getFromThrift(get)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public boolean exists(ByteBuffer table, TGet get) throws TIOError, TException { Table htable = getTable(table); try { return htable.exists(getFromThrift(get)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public TResult get(ByteBuffer table, TGet get) throws TIOError, TException { Table htable = getTable(table); try { return resultFromHBase(htable.get(getFromThrift(get))); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public TResult get(ByteBuffer table, TGet get) throws TIOError, TException { Table htable = getTable(table); try { return resultFromHBase(htable.get(getFromThrift(get))); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
Get get = getFromThrift(tGet); assertArrayEquals(get.getAttribute("attribute1"), attributeValue);
Get get = getFromThrift(tGet); assertArrayEquals(get.getAttribute("attribute1"), attributeValue);