Java Code Examples for org.apache.accumulo.core.client.IteratorSetting#getOptions()
The following examples show how to use
org.apache.accumulo.core.client.IteratorSetting#getOptions() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetricsTableConfigHelperTest.java From datawave with Apache License 2.0 | 6 votes |
@Test public void shouldConfigureAggregators() throws Exception { String table = MetricsConfiguration.getTable(conf); configHelper.configure(tops); IteratorSetting is = tops.getIteratorSetting(table, "sum", IteratorScope.scan); assertEquals(SummingCombiner.class.getName(), is.getIteratorClass()); assertEquals(TestKeyValueCountMetricsReceiver.ITER_PRIORITY, is.getPriority()); Map<String,String> options = is.getOptions(); String type = options.get("type"); String columns = options.get("columns"); assertEquals(Metric.KV_PER_TABLE.toString(), columns); assertEquals("STRING", type); }
Example 2
Source File: AccumuloRdfConfiguration.java From rya with Apache License 2.0 | 6 votes |
public void setAdditionalIterators(final IteratorSetting... additionalIterators){ //TODO do we need to worry about cleaning up this.set(ITERATOR_SETTINGS_SIZE, Integer.toString(additionalIterators.length)); int i = 0; for(final IteratorSetting iterator : additionalIterators) { this.set(String.format(ITERATOR_SETTINGS_NAME, i), iterator.getName()); this.set(String.format(ITERATOR_SETTINGS_CLASS, i), iterator.getIteratorClass()); this.set(String.format(ITERATOR_SETTINGS_PRIORITY, i), Integer.toString(iterator.getPriority())); final Map<String, String> options = iterator.getOptions(); this.set(String.format(ITERATOR_SETTINGS_OPTIONS_SIZE, i), Integer.toString(options.size())); final Iterator<Entry<String, String>> it = options.entrySet().iterator(); int j = 0; while(it.hasNext()) { final Entry<String, String> item = it.next(); this.set(String.format(ITERATOR_SETTINGS_OPTIONS_KEY, i, j), item.getKey()); this.set(String.format(ITERATOR_SETTINGS_OPTIONS_VALUE, i, j), item.getValue()); j++; } i++; } }
Example 3
Source File: AccumuloOperations.java From geowave with Apache License 2.0 | 6 votes |
@Override public Map<String, String> getServerOpOptions( final String index, final String serverOpName, final ServerOpScope scope) { try { final IteratorSetting setting = connector.tableOperations().getIteratorSetting( getQualifiedTableName(index), serverOpName, toAccumulo(scope)); if (setting != null) { return setting.getOptions(); } } catch (AccumuloSecurityException | AccumuloException | TableNotFoundException e) { LOGGER.error("Unable to get iterator options for table '" + index + "'", e); } return Collections.emptyMap(); }
Example 4
Source File: MetricsTableConfigHelperTest.java From datawave with Apache License 2.0 | 5 votes |
@Test public void shouldUpdateCombinerIfAlreadyExists() throws Exception { String table = MetricsConfiguration.getTable(conf); // Setup an initial iterator Map<String,String> options = new TreeMap<>(); options.put("type", "STRING"); options.put("columns", "COLUMN1"); IteratorSetting is = new IteratorSetting(TestKeyValueCountMetricsReceiver.ITER_PRIORITY, TestKeyValueCountMetricsReceiver.ITER_NAME, SummingCombiner.class.getName(), options); tops.attachIterator(table, is); // run test configHelper.configure(tops); // verify updates IteratorSetting newIter = tops.getIteratorSetting(table, "sum", IteratorScope.scan); assertEquals(SummingCombiner.class.getName(), newIter.getIteratorClass()); assertEquals(TestKeyValueCountMetricsReceiver.ITER_PRIORITY, newIter.getPriority()); Map<String,String> newOptions = newIter.getOptions(); String type = newOptions.get("type"); String columns = newOptions.get("columns"); assertEquals("COLUMN1," + Metric.KV_PER_TABLE, columns); assertEquals("STRING", type); }
Example 5
Source File: UnindexedNumericQueryTest.java From datawave with Apache License 2.0 | 5 votes |
@Test public void testNumericTerm() throws Exception { log.info("------ testNumericTerm ------"); String min = "115"; String iowa = "'indiana'"; String query = CityField.STATE.name() + EQ_OP + iowa + AND_OP + CityField.NUM.name() + GT_OP + min; ShardQueryConfiguration config = (ShardQueryConfiguration) setupConfig(query); // verify NUM is NumberType String indexStr = config.getIndexedFieldDataTypesAsString(); Assert.assertTrue(indexStr.contains(CityField.NUM.name() + ":" + NumberType.class.getName())); // NUM field should not be indexed Set<String> indexes = config.getIndexedFields(); Assert.assertFalse(indexes.contains(CityField.NUM.name())); NumberType nt = new NumberType(); String norm90 = nt.normalize(min); Iterator<QueryData> queries = config.getQueries(); Assert.assertTrue(queries.hasNext()); QueryData data = queries.next(); for (IteratorSetting it : data.getSettings()) { if (it.getIteratorClass().equals(QueryIterator.class.getName())) { Map<String,String> options = it.getOptions(); String qo = options.get(QueryOptions.QUERY); Assert.assertTrue(qo.contains(norm90)); } } }
Example 6
Source File: UnindexedNumericQueryTest.java From datawave with Apache License 2.0 | 5 votes |
@Test public void testRange() throws Exception { log.info("------ testRange ------"); String min = "90"; String max = "122"; String ohio = "'ohio'"; String iowa = "'iowa'"; String query = "(" + CityField.STATE.name() + EQ_OP + ohio + OR_OP + CityField.STATE.name() + EQ_OP + iowa + ")" + AND_OP + "(" + CityField.NUM.name() + GT_OP + min + AND_OP + CityField.NUM.name() + LT_OP + max + ")"; ShardQueryConfiguration config = (ShardQueryConfiguration) setupConfig(query); // verify NUM is NumberType String indexStr = config.getIndexedFieldDataTypesAsString(); Assert.assertTrue(indexStr.contains(CityField.NUM.name() + ":" + NumberType.class.getName())); // NUM field should not be indexed Set<String> indexes = config.getIndexedFields(); Assert.assertFalse(indexes.contains(CityField.NUM.name())); NumberType nt = new NumberType(); String norm90 = nt.normalize(min); String norm122 = nt.normalize(max); Iterator<QueryData> queries = config.getQueries(); Assert.assertTrue(queries.hasNext()); QueryData data = queries.next(); for (IteratorSetting it : data.getSettings()) { if (it.getIteratorClass().equals(QueryIterator.class.getName())) { Map<String,String> options = it.getOptions(); String qo = options.get(QueryOptions.QUERY); Assert.assertTrue(qo.contains(norm90)); Assert.assertTrue(qo.contains(norm122)); } } }