congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TableOperations.addSplits
Code IndexAdd Tabnine to your IDE (free)

How to use
addSplits
method
in
org.apache.accumulo.core.client.admin.TableOperations

Best Java code snippets using org.apache.accumulo.core.client.admin.TableOperations.addSplits (Showing top 20 results out of 315)

origin: prestodb/presto

public static synchronized DistributedQueryRunner createAccumuloQueryRunner(Map<String, String> extraProperties)
    throws Exception
{
  DistributedQueryRunner queryRunner =
      new DistributedQueryRunner(createSession(), 4, extraProperties);
  queryRunner.installPlugin(new TpchPlugin());
  queryRunner.createCatalog("tpch", "tpch");
  queryRunner.installPlugin(new AccumuloPlugin());
  Map<String, String> accumuloProperties =
      ImmutableMap.<String, String>builder()
          .put(AccumuloConfig.INSTANCE, connector.getInstance().getInstanceName())
          .put(AccumuloConfig.ZOOKEEPERS, connector.getInstance().getZooKeepers())
          .put(AccumuloConfig.USERNAME, MAC_USER)
          .put(AccumuloConfig.PASSWORD, MAC_PASSWORD)
          .put(AccumuloConfig.ZOOKEEPER_METADATA_ROOT, "/presto-accumulo-test")
          .build();
  queryRunner.createCatalog("accumulo", "accumulo", accumuloProperties);
  if (!tpchLoaded) {
    copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), TpchTable.getTables());
    connector.tableOperations().addSplits("tpch.orders", ImmutableSortedSet.of(new Text(new LexicoderRowSerializer().encode(BIGINT, 7500L))));
    tpchLoaded = true;
  }
  return queryRunner;
}
origin: apache/accumulo

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
  throws Exception {
 final String tableName = OptUtil.getTableOpt(cl, shellState);
 final boolean decode = cl.hasOption(base64Opt.getOpt());
 final TreeSet<Text> splits = new TreeSet<>();
 if (cl.hasOption(optSplitsFile.getOpt())) {
  splits.addAll(ShellUtil.scanFile(cl.getOptionValue(optSplitsFile.getOpt()), decode));
 } else {
  if (cl.getArgList().isEmpty()) {
   throw new MissingArgumentException("No split points specified");
  }
  for (String s : cl.getArgs()) {
   splits.add(new Text(s.getBytes(Shell.CHARSET)));
  }
 }
 if (!shellState.getAccumuloClient().tableOperations().exists(tableName)) {
  throw new TableNotFoundException(null, tableName, null);
 }
 shellState.getAccumuloClient().tableOperations().addSplits(tableName, splits);
 return 0;
}
origin: org.apache.accumulo/accumulo-test

private void addSplits(TableOperations opts, String... points) throws Exception {
 SortedSet<Text> splits = new TreeSet<>();
 for (String point : points) {
  splits.add(new Text(point));
 }
 opts.addSplits(MetadataTable.NAME, splits);
}
origin: org.apache.accumulo/accumulo-test

 @Override
 public void run() {
  try {
   TreeSet<Text> splits = new TreeSet<>();
   splits.add(new Text("X"));
   conn.tableOperations().addSplits(tableName, splits);
  } catch (Exception e) {
   ex.set(e);
  }
 }
};
origin: org.apache.accumulo/accumulo-test

public void addSplits(Connector connector, String tableName)
  throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
 // Add 10 splits to the table
 SortedSet<Text> partitions = new TreeSet<>();
 for (String s : "b,e,g,j,l,o,q,t,v,y".split(","))
  partitions.add(new Text(s));
 connector.tableOperations().addSplits(tableName, partitions);
}
origin: org.apache.accumulo/accumulo-test

 private void splitTable(TableOperations tOps, String tableName) throws Exception {
  SortedSet<Text> splits = new TreeSet<>();
  for (int i = 1; i <= 9; i++) {
   splits.add(new Text(itos(i * (ROWS / 10))));
  }
  log.debug("Adding splits to " + tableName);
  tOps.addSplits(tableName, splits);
 }
}
origin: Accla/graphulo

/** Copy the splits placed on table t1 to table t2. */
public static void copySplits(TableOperations tops, String t1, String t2) throws AccumuloException {
 try {
  Collection<Text> splits = tops.listSplits(t1);
  SortedSet<Text> ss = new TreeSet<>(splits);
  tops.addSplits(t2, ss);
 } catch (TableNotFoundException | AccumuloSecurityException e) {
  log.error("cannot handle splits copying from "+t1+" to "+t2, e);
  throw new RuntimeException(e);
 }
}
origin: Accla/graphulo

public void addSplit(String tableName, SortedSet<Text> partitions) {
  try {
    connector.tableOperations().addSplits(tableName, partitions);
  } catch (TableNotFoundException | AccumuloException | AccumuloSecurityException e) {
    log.warn("",e);
  }
}
public Instance getInstance() {	
origin: org.apache.accumulo/accumulo-test

 @Override
 public void run() {
  try {
   // split the table
   final SortedSet<Text> afterEnd = SPLITS.tailSet(new Text(end.toString() + "\0"));
   conn.tableOperations().addSplits(tableName, afterEnd);
  } catch (Exception ex) {
   log.error("Exception", ex);
   synchronized (fail) {
    fail[0] = true;
   }
  }
 }
};
origin: org.apache.accumulo/accumulo-test

 @Override
 public void run() {
  try {
   getConnector().tableOperations().addSplits(finalName, splits);
  } catch (TableNotFoundException ex) {
   // expected, ignore
  } catch (Exception ex) {
   throw new RuntimeException(finalName, ex);
  }
 }
});
origin: org.apache.accumulo/accumulo-test

@Override
protected void runLater(State state, Environment env) throws Exception {
 SortedSet<Text> splits = new TreeSet<>();
 Random rand = (Random) state.get("rand");
 int count = rand.nextInt(20);
 for (int i = 0; i < count; i++)
  splits.add(new Text(String.format(BulkPlusOne.FMT,
    (rand.nextLong() & 0x7fffffffffffffffl) % BulkPlusOne.LOTS)));
 log.info("splitting " + splits);
 env.getConnector().tableOperations().addSplits(Setup.getTableName(), splits);
 log.info("split for " + splits + " finished");
}
origin: org.apache.accumulo/accumulo-test

@Test(expected = AccumuloException.class)
public void testRootTableSplit() throws Exception {
 TableOperations opts = getConnector().tableOperations();
 SortedSet<Text> splits = new TreeSet<>();
 splits.add(new Text("5"));
 opts.addSplits(RootTable.NAME, splits);
}
origin: org.apache.accumulo/accumulo-test

@Override
public void visit(State state, Environment env, Properties props) throws Exception {
 String table = state.getString("tableName");
 Random rand = (Random) state.get("rand");
 Connector conn = env.getConnector();
 String row = Utils.getBank(rand.nextInt((Integer) state.get("numBanks")));
 log.debug("adding split " + row);
 conn.tableOperations().addSplits(table, new TreeSet<>(Arrays.asList(new Text(row))));
}
origin: org.apache.accumulo/accumulo-test

@Test
public void testPreSplit() throws Exception {
 String tableName = getUniqueNames(1)[0];
 Connector c = getConnector();
 c.tableOperations().create(tableName);
 SortedSet<Text> splits = new TreeSet<>();
 splits.add(new Text("8"));
 splits.add(new Text("256"));
 c.tableOperations().addSplits(tableName, splits);
 runTest(c, tableName);
}
origin: org.apache.accumulo/accumulo-proxy

@Override
public void addSplits(ByteBuffer login, String tableName, Set<ByteBuffer> splits)
  throws org.apache.accumulo.proxy.thrift.AccumuloException,
  org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
  org.apache.accumulo.proxy.thrift.TableNotFoundException, TException {
 try {
  SortedSet<Text> sorted = new TreeSet<>();
  for (ByteBuffer split : splits) {
   sorted.add(ByteBufferUtil.toText(split));
  }
  getConnector(login).tableOperations().addSplits(tableName, sorted);
 } catch (Exception e) {
  handleExceptionTNF(e);
 }
}
origin: org.apache.accumulo/accumulo-test

@After
public void restoreMetadataSplits() throws Exception {
 if (null != metadataSplits) {
  log.info("Restoring split on metadata table");
  Connector conn = getConnector();
  conn.tableOperations().merge(MetadataTable.NAME, null, null);
  conn.tableOperations().addSplits(MetadataTable.NAME, new TreeSet<>(metadataSplits));
 }
}
origin: org.apache.accumulo/accumulo-test

@Override
public void visit(State state, Environment env, Properties props) throws Exception {
 String indexTableName = (String) state.get("indexTableName");
 int numPartitions = (Integer) state.get("numPartitions");
 Random rand = (Random) state.get("rand");
 SortedSet<Text> splitSet = ShardFixture.genSplits(numPartitions,
   rand.nextInt(numPartitions) + 1, "%06x");
 log.debug("adding splits " + indexTableName);
 env.getConnector().tableOperations().addSplits(indexTableName, splitSet);
}
origin: org.apache.accumulo/accumulo-test

private void createTable(String t, boolean online) throws AccumuloSecurityException,
  AccumuloException, TableNotFoundException, TableExistsException {
 Connector conn = getConnector();
 conn.tableOperations().create(t);
 conn.tableOperations().online(t, true);
 SortedSet<Text> partitionKeys = new TreeSet<>();
 partitionKeys.add(new Text("some split"));
 conn.tableOperations().addSplits(t, partitionKeys);
 if (!online) {
  conn.tableOperations().offline(t, true);
 }
}
origin: Accla/graphulo

private void createSeqTable(String table) {
 // create tables if they don't exist
 if (!connector.tableOperations().exists(table)) {
  IteratorSetting longCombiner = new IteratorSetting(1, SummingCombiner.class);
  SummingCombiner.setCombineAllColumns(longCombiner, true);
  SummingCombiner.setEncodingType(longCombiner, LongLexicoderTemp.class);
  try {
   connector.tableOperations().create(table);
   connector.tableOperations().addSplits(table, getSplitPoints(3));
   GraphuloUtil.applyIteratorSoft(longCombiner, connector.tableOperations(), table);
  } catch (AccumuloException | AccumuloSecurityException | TableNotFoundException | TableExistsException e) {
   log.warn("", e);
  }
 }
}
origin: NationalSecurityAgency/datawave

private MiniAccumuloCluster createMiniAccumuloWithTestTableAndSplits(SortedSet<Text> sortedSet) throws IOException, InterruptedException,
        AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
  MiniAccumuloCluster accumuloCluster;
  accumuloCluster = new MiniAccumuloCluster(Files.createTempDir(), PASSWORD);
  accumuloCluster.start();
  
  Connector connector = accumuloCluster.getConnector(USERNAME, PASSWORD);
  TableOperations tableOperations = connector.tableOperations();
  tableOperations.create(TABLE_NAME);
  tableOperations.addSplits(TABLE_NAME, sortedSet);
  
  return accumuloCluster;
}

org.apache.accumulo.core.client.adminTableOperationsaddSplits

Javadoc

Ensures that tablets are split along a set of keys.

Note that while the documentation for Text specifies that its bytestream should be UTF-8, the encoding is not enforced by operations that work with byte arrays.

For example, you can create 256 evenly-sliced splits via the following code sample even though the given byte sequences are not valid UTF-8.

 
TableOperations tableOps = client.tableOperations(); 
TreeSet<Text> splits = new TreeSet<Text>(); 
for (int i = 0; i < 256; i++) { 
byte[] bytes = {(byte) i}; 
splits.add(new Text(bytes)); 
} 
tableOps.addSplits(TABLE_NAME, splits); 

Popular methods of TableOperations

  • create
  • exists
    A method to check if a table exists in Accumulo.
  • delete
    Delete a table
  • attachIterator
    Add an iterator to a table on the given scopes.
  • setProperty
    Sets a property on a table. This operation is asynchronous and eventually consistent. Not all tablet
  • list
    Retrieve a list of tables in Accumulo.
  • tableIdMap
    Get a mapping of table name to internal table id.
  • listIterators
    Get a list of iterators for this table.
  • listSplits
  • compact
    Starts a full major compaction of the tablets in the range (start, end]. The compaction is preformed
  • flush
    Flush a table's data that is currently in memory.
  • getProperties
    Gets properties of a table. This operation is asynchronous and eventually consistent. It is not guar
  • flush,
  • getProperties,
  • setLocalityGroups,
  • deleteRows,
  • removeIterator,
  • getIteratorSetting,
  • importDirectory,
  • testClassLoad,
  • getLocalityGroups

Popular in Java

  • Making http post requests using okhttp
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • JButton (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now