@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { final String tableName = OptUtil.getTableOpt(cl, shellState); final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState); final Range range = getRange(cl, interpeter); final Authorizations auths = getAuths(cl, shellState); final Text startRow = range.getStartKey() == null ? null : range.getStartKey().getRow(); final Text endRow = range.getEndKey() == null ? null : range.getEndKey().getRow(); try { final Text max = shellState.getAccumuloClient().tableOperations().getMaxRow(tableName, auths, startRow, range.isStartKeyInclusive(), endRow, range.isEndKeyInclusive()); if (max != null) { shellState.getReader().println(max.toString()); } } catch (Exception e) { log.debug("Could not get shell state.", e); } return 0; }
Text max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, rows.get(i), false); assertEquals(rows.get(i - 1), max); max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1), true, rows.get(i), false); assertEquals(rows.get(i - 1), max); max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1), false, rows.get(i), false); assertNull(max); max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, rows.get(i), true); assertEquals(rows.get(i), max); max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i), true, rows.get(i), true); assertEquals(rows.get(i), max); max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1), false, rows.get(i), true); assertEquals(rows.get(i), max); Text max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, null, true); assertEquals(rows.get(rows.size() - 1), max); max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
public boolean isEmpty() { try { TableOperations tableOps = globals.getConfig().getConnector().tableOperations(); for (String table : globals.getConfig().getTableNames()) { if (tableOps.getMaxRow(table, globals.getConfig().getAuthorizations(), null, true, null, true) != null) { return false; } } return true; } catch (Exception e) { throw new AccumuloGraphException(e); } } }
public boolean isEmpty() { try { TableOperations tableOps = globals.getConfig().getConnector().tableOperations(); for (String table : globals.getConfig().getTableNames()) { if (tableOps.getMaxRow(table, globals.getConfig().getAuthorizations(), null, true, null, true) != null) { return false; } } return true; } catch (Exception e) { throw new AccumuloGraphException(e); } } }
@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { final String tableName = OptUtil.getTableOpt(cl, shellState); final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState); final Range range = getRange(cl, interpeter); final Authorizations auths = getAuths(cl, shellState); final Text startRow = range.getStartKey() == null ? null : range.getStartKey().getRow(); final Text endRow = range.getEndKey() == null ? null : range.getEndKey().getRow(); try { final Text max = shellState.getConnector().tableOperations().getMaxRow(tableName, auths, startRow, range.isStartKeyInclusive(), endRow, range.isEndKeyInclusive()); if (max != null) { shellState.getReader().println(max.toString()); } } catch (Exception e) { log.debug("Could not get shell state.", e); } return 0; }
@Override public ByteBuffer getMaxRow(ByteBuffer login, String tableName, Set<ByteBuffer> auths, ByteBuffer startRow, boolean startInclusive, ByteBuffer endRow, boolean endInclusive) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, TException { try { Connector connector = getConnector(login); Text startText = ByteBufferUtil.toText(startRow); Text endText = ByteBufferUtil.toText(endRow); Authorizations auth; if (auths != null) { auth = getAuthorizations(auths); } else { auth = connector.securityOperations().getUserAuthorizations(connector.whoami()); } Text max = connector.tableOperations().getMaxRow(tableName, auth, startText, startInclusive, endText, endInclusive); return TextUtil.getByteBuffer(max); } catch (Exception e) { handleExceptionTNF(e); return null; } }
break; case 16: ops.getMaxRow(tableName, Authorizations.EMPTY, a, true, z, true); fail(); break;