@Override public void create(String tableName) throws AccumuloException, AccumuloSecurityException, TableExistsException { create(tableName, new NewTableConfiguration()); }
NewTableConfiguration ntc = new NewTableConfiguration();
@Override public void create(String tableName) throws AccumuloException, AccumuloSecurityException, TableExistsException { create(tableName, new NewTableConfiguration()); }
@Override public void create(String tableName) throws AccumuloException, AccumuloSecurityException, TableExistsException { create(tableName, new NewTableConfiguration()); }
@Override @Deprecated public void create(String tableName, boolean limitVersion, TimeType timeType) throws AccumuloException, AccumuloSecurityException, TableExistsException { checkArgument(tableName != null, "tableName is null"); checkArgument(timeType != null, "timeType is null"); NewTableConfiguration ntc = new NewTableConfiguration().setTimeType(timeType); if (limitVersion) create(tableName, ntc); else create(tableName, ntc.withoutDefaultIterators()); }
@Override @Deprecated public void create(String tableName, boolean versioningIter, TimeType timeType) throws AccumuloException, AccumuloSecurityException, TableExistsException { NewTableConfiguration ntc = new NewTableConfiguration().setTimeType(timeType); if (versioningIter) create(tableName, ntc); else create(tableName, ntc.withoutDefaultIterators()); }
@Test public void testSample() throws Exception { final String TEST_TABLE_3 = getUniqueNames(1)[0]; Connector c = getConnector(); c.tableOperations().create(TEST_TABLE_3, new NewTableConfiguration().enableSampling(SAMPLER_CONFIG)); BatchWriter bw = c.createBatchWriter(TEST_TABLE_3, new BatchWriterConfig()); for (int i = 0; i < 100; i++) { Mutation m = new Mutation(new Text(String.format("%09x", i + 1))); m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes())); bw.addMutation(m); } bw.close(); Assert.assertEquals(0, MRTester .main(new String[] {TEST_TABLE_3, AccumuloInputFormat.class.getName(), "False", "True"})); assertEquals(39, assertionErrors.get(TEST_TABLE_3 + "_map").size()); assertEquals(2, assertionErrors.get(TEST_TABLE_3 + "_cleanup").size()); assertionErrors.clear(); Assert.assertEquals(0, MRTester .main(new String[] {TEST_TABLE_3, AccumuloInputFormat.class.getName(), "False", "False"})); assertEquals(1, assertionErrors.get(TEST_TABLE_3 + "_map").size()); assertEquals(1, assertionErrors.get(TEST_TABLE_3 + "_cleanup").size()); assertionErrors.clear(); Assert.assertEquals(0, MRTester .main(new String[] {TEST_TABLE_3, AccumuloInputFormat.class.getName(), "True", "True"})); assertEquals(39, assertionErrors.get(TEST_TABLE_3 + "_map").size()); assertEquals(2, assertionErrors.get(TEST_TABLE_3 + "_cleanup").size()); }
"Running merge test " + table + " " + Arrays.asList(splits) + " " + start + " " + end); conn.tableOperations().create(table, new NewTableConfiguration().setTimeType(TimeType.LOGICAL)); TreeSet<Text> splitSet = new TreeSet<>(); for (String split : splits) {
String tableName = getUniqueNames(2)[0]; connector.tableOperations().create(tableName, new NewTableConfiguration().setProperties(properties));
new NewTableConfiguration().withoutDefaultIterators() .setProperties(Collections.singletonMap(AccumuloProps.TABLE_DELETE_BEHAVIOR, AccumuloProps.TABLE_DELETE_BEHAVIOR_VALUE)));
private void runMergeTest(Connector conn, String table, String[] splits, String[] inserts, String start, String end, String last, long expected) throws Exception { log.info("table " + table); conn.tableOperations().create(table, new NewTableConfiguration().setTimeType(TimeType.LOGICAL)); TreeSet<Text> splitSet = new TreeSet<>(); for (String split : splits) { splitSet.add(new Text(split)); } conn.tableOperations().addSplits(table, splitSet); BatchWriter bw = conn.createBatchWriter(table, new BatchWriterConfig()); for (String row : inserts) { Mutation m = new Mutation(row); m.put("cf", "cq", "v"); bw.addMutation(m); } bw.flush(); conn.tableOperations().merge(table, start == null ? null : new Text(start), end == null ? null : new Text(end)); Mutation m = new Mutation(last); m.put("cf", "cq", "v"); bw.addMutation(m); bw.flush(); Scanner scanner = conn.createScanner(table, Authorizations.EMPTY); scanner.setRange(new Range(last)); bw.close(); long time = scanner.iterator().next().getKey().getTimestamp(); if (time != expected) throw new RuntimeException("unexpected time " + time + " " + expected); }
@Test public void testSample() throws Exception { final String TEST_TABLE_3 = getUniqueNames(1)[0]; Connector c = getConnector(); c.tableOperations().create(TEST_TABLE_3, new NewTableConfiguration().enableSampling(SAMPLER_CONFIG)); BatchWriter bw = c.createBatchWriter(TEST_TABLE_3, new BatchWriterConfig()); for (int i = 0; i < 100; i++) { Mutation m = new Mutation(new Text(String.format("%09x", i + 1))); m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes())); bw.addMutation(m); } bw.close(); MRTester.main(TEST_TABLE_3, "False", "True"); Assert.assertEquals(38, e1Count); Assert.assertEquals(1, e2Count); e2Count = e1Count = 0; MRTester.main(TEST_TABLE_3, "False", "False"); Assert.assertEquals(0, e1Count); Assert.assertEquals(0, e2Count); e2Count = e1Count = 0; MRTester.main(TEST_TABLE_3, "True", "True"); Assert.assertEquals(38, e1Count); Assert.assertEquals(1, e2Count); }
@SuppressWarnings("deprecation") @Test public void tableNameOnly() throws Exception { log.info("Starting tableNameOnly"); // Create a table with the initial properties Connector connector = getConnector(); String tableName = getUniqueNames(2)[0]; connector.tableOperations().create(tableName, new NewTableConfiguration()); String tableNameOrig = "original"; connector.tableOperations().create(tableNameOrig, true); int countNew = numProperties(connector, tableName); int countOrig = compareProperties(connector, tableNameOrig, tableName, null); Assert.assertEquals("Extra properties using the new create method", countOrig, countNew); Assert.assertTrue("Wrong TimeType", checkTimeType(connector, tableName, TimeType.MILLIS)); }
@SuppressWarnings("deprecation") @Test public void tableNameAndLimitVersion() throws Exception { log.info("Starting tableNameAndLimitVersion"); // Create a table with the initial properties Connector connector = getConnector(); String tableName = getUniqueNames(2)[0]; boolean limitVersion = false; connector.tableOperations().create(tableName, new NewTableConfiguration().withoutDefaultIterators()); String tableNameOrig = "originalWithLimitVersion"; connector.tableOperations().create(tableNameOrig, limitVersion); int countNew = numProperties(connector, tableName); int countOrig = compareProperties(connector, tableNameOrig, tableName, null); Assert.assertEquals("Extra properties using the new create method", countOrig, countNew); Assert.assertTrue("Wrong TimeType", checkTimeType(connector, tableName, TimeType.MILLIS)); }
private static void createTable(Connector connector, String tableName) { try { NewTableConfiguration config = new NewTableConfiguration() .withoutDefaultIterators() .setTimeType(TimeType.MILLIS); connector.tableOperations().create(tableName, config); } catch (Exception e) { throw new VertexiumException("Unable to create table " + tableName); } } }
@SuppressWarnings("deprecation") @Test public void tableNameLimitVersionAndTimeType() throws Exception { log.info("Starting tableNameLimitVersionAndTimeType"); // Create a table with the initial properties Connector connector = getConnector(); String tableName = getUniqueNames(2)[0]; boolean limitVersion = false; TimeType tt = TimeType.LOGICAL; connector.tableOperations().create(tableName, new NewTableConfiguration().withoutDefaultIterators().setTimeType(tt)); String tableNameOrig = "originalWithLimitVersionAndTimeType"; connector.tableOperations().create(tableNameOrig, limitVersion, tt); int countNew = numProperties(connector, tableName); int countOrig = compareProperties(connector, tableNameOrig, tableName, null); Assert.assertEquals("Extra properties using the new create method", countOrig, countNew); Assert.assertTrue("Wrong TimeType", checkTimeType(connector, tableName, tt)); }
String clone = tableName + "_clone"; conn.tableOperations().create(tableName, new NewTableConfiguration().enableSampling(SC1));
@Override public void createTable(ByteBuffer login, String tableName, boolean versioningIter, org.apache.accumulo.proxy.thrift.TimeType type) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableExistsException, TException { try { if (type == null) type = org.apache.accumulo.proxy.thrift.TimeType.MILLIS; NewTableConfiguration tConfig = new NewTableConfiguration() .setTimeType(TimeType.valueOf(type.toString())); if (!versioningIter) tConfig = tConfig.withoutDefaultIterators(); getConnector(login).tableOperations().create(tableName, tConfig); } catch (TableExistsException e) { throw new org.apache.accumulo.proxy.thrift.TableExistsException(e.toString()); } catch (Exception e) { handleException(e); } }
protected static void ensureTableExists(Connector connector, String tableName, Integer maxVersions, String hdfsContextClasspath, boolean createTable) { try { if (!connector.tableOperations().exists(tableName)) { if (!createTable) { throw new VertexiumException("Table '" + tableName + "' does not exist and 'graph." + GraphConfiguration.CREATE_TABLES + "' is set to false"); } NewTableConfiguration ntc = new NewTableConfiguration() .setTimeType(TimeType.MILLIS) .withoutDefaultIterators(); connector.tableOperations().create(tableName, ntc); if (maxVersions != null) { // The following parameters match the Accumulo defaults for the VersioningIterator IteratorSetting versioningSettings = new IteratorSetting( ACCUMULO_DEFAULT_VERSIONING_ITERATOR_PRIORITY, ACCUMULO_DEFAULT_VERSIONING_ITERATOR_NAME, VersioningIterator.class ); VersioningIterator.setMaxVersions(versioningSettings, maxVersions); EnumSet<IteratorUtil.IteratorScope> scope = EnumSet.allOf(IteratorUtil.IteratorScope.class); connector.tableOperations().attachIterator(tableName, versioningSettings, scope); } } if (hdfsContextClasspath != null) { connector.instanceOperations().setProperty("general.vfs.context.classpath." + CLASSPATH_CONTEXT_NAME + "-" + tableName, hdfsContextClasspath); connector.tableOperations().setProperty(tableName, "table.classpath.context", CLASSPATH_CONTEXT_NAME + "-" + tableName); } } catch (Exception e) { throw new VertexiumException("Unable to create table " + tableName, e); } }
protected static void ensureTableExists(Connector connector, String tableName, Integer maxVersions, String hdfsContextClasspath, boolean createTable) { try { if (!connector.tableOperations().exists(tableName)) { if (!createTable) { throw new VertexiumException("Table '" + tableName + "' does not exist and 'graph." + GraphConfiguration.CREATE_TABLES + "' is set to false"); } NewTableConfiguration ntc = new NewTableConfiguration() .setTimeType(TimeType.MILLIS) .withoutDefaultIterators(); connector.tableOperations().create(tableName, ntc); if (maxVersions != null) { // The following parameters match the Accumulo defaults for the VersioningIterator IteratorSetting versioningSettings = new IteratorSetting( ACCUMULO_DEFAULT_VERSIONING_ITERATOR_PRIORITY, ACCUMULO_DEFAULT_VERSIONING_ITERATOR_NAME, VersioningIterator.class ); VersioningIterator.setMaxVersions(versioningSettings, maxVersions); EnumSet<IteratorUtil.IteratorScope> scope = EnumSet.allOf(IteratorUtil.IteratorScope.class); connector.tableOperations().attachIterator(tableName, versioningSettings, scope); } } if (hdfsContextClasspath != null) { connector.instanceOperations().setProperty("general.vfs.context.classpath." + CLASSPATH_CONTEXT_NAME + "-" + tableName, hdfsContextClasspath); connector.tableOperations().setProperty(tableName, "table.classpath.context", CLASSPATH_CONTEXT_NAME + "-" + tableName); } } catch (Exception e) { throw new VertexiumException("Unable to create table " + tableName, e); } }