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

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

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

origin: prestodb/presto

public void setLocalityGroups(String tableName, Map<String, Set<Text>> groups)
{
  if (groups.isEmpty()) {
    return;
  }
  try {
    connector.tableOperations().setLocalityGroups(tableName, groups);
    LOG.debug("Set locality groups for %s to %s", tableName, groups);
  }
  catch (AccumuloException | AccumuloSecurityException e) {
    throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to set locality groups", e);
  }
  catch (TableNotFoundException e) {
    throw new PrestoException(ACCUMULO_TABLE_DNE, "Failed to set locality groups, table does not exist", e);
  }
}
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 HashMap<String,Set<Text>> groups = new HashMap<>();
 for (String arg : cl.getArgs()) {
  final String sa[] = arg.split("=", 2);
  if (sa.length < 2) {
   throw new IllegalArgumentException("Missing '='");
  }
  final String group = sa[0];
  final HashSet<Text> colFams = new HashSet<>();
  for (String family : sa[1].split(",")) {
   colFams.add(new Text(family.getBytes(Shell.CHARSET)));
  }
  groups.put(group, colFams);
 }
 shellState.getAccumuloClient().tableOperations().setLocalityGroups(tableName, groups);
 return 0;
}
origin: NationalSecurityAgency/datawave

  private void addLocalityGroup(final TableOperations tops, final String tableName, final String localityGroup) throws AccumuloException,
          TableNotFoundException, AccumuloSecurityException {
    if (tops.exists(tableName)) {
      final Map<String,Set<Text>> localityGroups = tops.getLocalityGroups(tableName);
      
      final Set<Text> groupSet = new HashSet<>();
      
      groupSet.add(new Text(localityGroup));
      
      localityGroups.put(localityGroup, groupSet);
      
      tops.setLocalityGroups(tableName, localityGroups);
    }
  }
}
origin: org.apache.rya/rya.indexing

/**
 *
 * @param tableName
 * @param conn
 * @param groups
 *            - locality groups to be created
 *
 *            Sets locality groups for more efficient scans - these are
 *            usually the variable orders in the table so that scans for
 *            specific orders are more efficient
 */
private void setLocalityGroups(final String tableName, final Connector conn,
    final List<String> groups) {
  final HashMap<String, Set<Text>> localityGroups = new HashMap<String, Set<Text>>();
  for (int i = 0; i < groups.size(); i++) {
    final HashSet<Text> tempColumn = new HashSet<Text>();
    tempColumn.add(new Text(groups.get(i)));
    final String groupName = groups.get(i).replace(VALUE_DELIM, "");
    localityGroups.put(groupName, tempColumn);
  }
  try {
    conn.tableOperations().setLocalityGroups(tableName, localityGroups);
  } catch (AccumuloException | AccumuloSecurityException
      | TableNotFoundException e) {
    e.printStackTrace();
  }
}
origin: apache/incubator-rya

/**
 *
 * @param tableName
 * @param conn
 * @param groups
 *            - locality groups to be created
 *
 *            Sets locality groups for more efficient scans - these are
 *            usually the variable orders in the table so that scans for
 *            specific orders are more efficient
 */
private void setLocalityGroups(final String tableName, final Connector conn,
    final List<String> groups) {
  final HashMap<String, Set<Text>> localityGroups = new HashMap<String, Set<Text>>();
  for (int i = 0; i < groups.size(); i++) {
    final HashSet<Text> tempColumn = new HashSet<Text>();
    tempColumn.add(new Text(groups.get(i)));
    final String groupName = groups.get(i).replace(VALUE_DELIM, "");
    localityGroups.put(groupName, tempColumn);
  }
  try {
    conn.tableOperations().setLocalityGroups(tableName, localityGroups);
  } catch (AccumuloException | AccumuloSecurityException
      | TableNotFoundException e) {
    e.printStackTrace();
  }
}
origin: org.apache.accumulo/accumulo-proxy

@Override
public void setLocalityGroups(ByteBuffer login, String tableName,
  Map<String,Set<String>> groupStrings)
  throws org.apache.accumulo.proxy.thrift.AccumuloException,
  org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
  org.apache.accumulo.proxy.thrift.TableNotFoundException, TException {
 try {
  Map<String,Set<Text>> groups = new HashMap<>();
  for (Entry<String,Set<String>> groupEntry : groupStrings.entrySet()) {
   groups.put(groupEntry.getKey(), new HashSet<Text>());
   for (String val : groupEntry.getValue()) {
    groups.get(groupEntry.getKey()).add(new Text(val));
   }
  }
  getConnector(login).tableOperations().setLocalityGroups(tableName, groups);
 } catch (Exception e) {
  handleExceptionTNF(e);
 }
}
origin: org.apache.accumulo/accumulo-shell

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
  throws Exception {
 final String tableName = OptUtil.getTableOpt(cl, shellState);
 final HashMap<String,Set<Text>> groups = new HashMap<>();
 for (String arg : cl.getArgs()) {
  final String sa[] = arg.split("=", 2);
  if (sa.length < 2) {
   throw new IllegalArgumentException("Missing '='");
  }
  final String group = sa[0];
  final HashSet<Text> colFams = new HashSet<>();
  for (String family : sa[1].split(",")) {
   colFams.add(new Text(family.getBytes(Shell.CHARSET)));
  }
  groups.put(group, colFams);
 }
 shellState.getConnector().tableOperations().setLocalityGroups(tableName, groups);
 return 0;
}
origin: NationalSecurityAgency/datawave

tops.setLocalityGroups(tableName, localityGroups);
log.info("Reset the locality groups for " + tableName + " to " + localityGroups);
origin: org.apache.accumulo/accumulo-test

private static void setupLocalityGroups(Connector conn, int numlg, ArrayList<byte[]> cfset,
  String table) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
 if (numlg > 1) {
  int numCF = cfset.size() / numlg;
  int gNum = 0;
  Iterator<byte[]> cfiter = cfset.iterator();
  Map<String,Set<Text>> groups = new HashMap<>();
  while (cfiter.hasNext()) {
   HashSet<Text> groupCols = new HashSet<>();
   for (int i = 0; i < numCF && cfiter.hasNext(); i++) {
    groupCols.add(new Text(cfiter.next()));
   }
   groups.put("lg" + (gNum++), groupCols);
  }
  conn.tableOperations().setLocalityGroups(table, groups);
  conn.tableOperations().offline(table);
  sleepUninterruptibly(1, TimeUnit.SECONDS);
  conn.tableOperations().online(table);
 }
}
origin: uk.gov.gchq.gaffer/accumulo-store

public static void setLocalityGroups(final AccumuloStore store) throws StoreException {
  final String tableName = store.getTableName();
  Map<String, Set<Text>> localityGroups =
      new HashMap<>();
  for (final String group : store.getSchema().getGroups()) {
    HashSet<Text> localityGroup = new HashSet<>();
    localityGroup.add(new Text(group));
    localityGroups.put(group, localityGroup);
  }
  LOGGER.info("Setting locality groups on table {}", tableName);
  try {
    store.getConnection().tableOperations().setLocalityGroups(tableName, localityGroups);
  } catch (final AccumuloException | AccumuloSecurityException | TableNotFoundException e) {
    throw new StoreException(e.getMessage(), e);
  }
}
origin: apache/incubator-rya

public void setLocalityGroups() {
  
  HashMap<String, Set<Text>> localityGroups = new HashMap<String, Set<Text>>();
  Iterator<String> groups = getPredicates();
  
  int i = 1;
  
  while(groups.hasNext()) {
    HashSet<Text> tempColumn = new HashSet<Text>();
    String temp = groups.next();
    tempColumn.add(new Text(temp));
    String groupName = "predicate" + i;
    localityGroups.put(groupName, tempColumn);
    i++;
  }
  
  try {
    conn.tableOperations().setLocalityGroups(tablePrefix + "doc_partitioned_index", localityGroups);
    //conn.tableOperations().compact(tablePrefix + "doc_partitioned_index", null, null, true, true);
  } catch (AccumuloException e) {
    e.printStackTrace();
  } catch (AccumuloSecurityException e) {
    e.printStackTrace();
  } catch (TableNotFoundException e) {
    e.printStackTrace();
  }
  
  
}

origin: org.apache.rya/rya.indexing

public void setLocalityGroups() {
  
  HashMap<String, Set<Text>> localityGroups = new HashMap<String, Set<Text>>();
  Iterator<String> groups = getPredicates();
  
  int i = 1;
  
  while(groups.hasNext()) {
    HashSet<Text> tempColumn = new HashSet<Text>();
    String temp = groups.next();
    tempColumn.add(new Text(temp));
    String groupName = "predicate" + i;
    localityGroups.put(groupName, tempColumn);
    i++;
  }
  
  try {
    conn.tableOperations().setLocalityGroups(tablePrefix + "doc_partitioned_index", localityGroups);
    //conn.tableOperations().compact(tablePrefix + "doc_partitioned_index", null, null, true, true);
  } catch (AccumuloException e) {
    e.printStackTrace();
  } catch (AccumuloSecurityException e) {
    e.printStackTrace();
  } catch (TableNotFoundException e) {
    e.printStackTrace();
  }
  
  
}

origin: org.apache.accumulo/accumulo-test

conn.tableOperations().setLocalityGroups(imageTableName, groups);
log.debug("Configured locality groups for " + imageTableName + " groups = " + groups);
origin: org.apache.accumulo/accumulo-test

Map<String,Set<Text>> groups = new TreeMap<>();
groups.put("g1", Collections.singleton(t("colf")));
connector.tableOperations().setLocalityGroups(tableName, groups);
ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), 2000, 1, 50, 0,
  tableName);
origin: org.apache.accumulo/accumulo-test

tableOps.setLocalityGroups(state.getString("imageTableName"), groups);
origin: io.fluo/fluo-core

Map<String, Set<Text>> groups = new HashMap<>();
groups.put("notify", Collections.singleton(ByteUtil.toText(ColumnConstants.NOTIFY_CF)));
conn.tableOperations().setLocalityGroups(config.getAccumuloTable(), groups);
origin: org.apache.accumulo/accumulo-test

groups.put("lg1", Collections.singleton(new Text("foo")));
groups.put("dg", Collections.<Text> emptySet());
c.tableOperations().setLocalityGroups(tableName, groups);
IteratorSetting setting = new IteratorSetting(30, RowDeletingIterator.class);
c.tableOperations().attachIterator(tableName, setting, EnumSet.of(IteratorScope.majc));
origin: NationalSecurityAgency/datawave

mock.setLocalityGroups(EasyMock.anyObject(String.class), EasyMock.anyObject(groups.getClass()));
EasyMock.expectLastCall().andAnswer(() -> {
origin: NationalSecurityAgency/datawave

mock.setLocalityGroups(EasyMock.anyObject(String.class), EasyMock.anyObject(groups.getClass()));
EasyMock.expectLastCall().andAnswer(() -> {
origin: org.apache.accumulo/accumulo-test

int i = 0;
for (String cfg : config) {
 to.setLocalityGroups(table, getGroups(cfg));
 ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * (i + 1), 1, 50,
   ROWS * i, table);
 ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * i, 1, 50, 0,
   "xyz", table);
 to.setLocalityGroups(table, getGroups(cfg));
 to.flush(table, null, null, true);
 verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * i, 1, 50, 0,
org.apache.accumulo.core.client.adminTableOperationssetLocalityGroups

Javadoc

Sets a table's locality groups. A table's locality groups can be changed at any time.

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
  • addSplits
    Ensures that tablets are split along a set of keys. Note that while the documentation for Text speci
  • 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.
  • compact,
  • flush,
  • getProperties,
  • deleteRows,
  • removeIterator,
  • getIteratorSetting,
  • importDirectory,
  • testClassLoad,
  • getLocalityGroups

Popular in Java

  • Making http requests using okhttp
  • startActivity (Activity)
  • runOnUiThread (Activity)
  • addToBackStack (FragmentTransaction)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top 12 Jupyter Notebook extensions
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