本文整理汇总了Java中org.apache.accumulo.core.client.IteratorSetting.addOption方法的典型用法代码示例。如果您正苦于以下问题:Java IteratorSetting.addOption方法的具体用法?Java IteratorSetting.addOption怎么用?Java IteratorSetting.addOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.accumulo.core.client.IteratorSetting
的用法示例。
在下文中一共展示了IteratorSetting.addOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRateOptions
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
public static void setRateOptions(IteratorSetting is, QueryRequest.RateOption options) {
if (options != null && options.isCounter()) {
LOG.trace("Setting rate counter options cm:{}, rv:{}", options.getCounterMax(), options.getResetValue());
is.addOption(COUNTER_MAX, Long.toString(options.getCounterMax()));
is.addOption(RATE_RESET_VALUE, Long.toString(options.getResetValue()));
}
}
示例2: testMovingAverage
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
@Test
public void testMovingAverage() throws Exception {
SortedMapIterator source = new SortedMapIterator(table);
TimeSeriesGroupingIterator iter = new TimeSeriesGroupingIterator();
IteratorSetting settings = new IteratorSetting(100, TimeSeriesGroupingIterator.class);
settings.addOption(TimeSeriesGroupingIterator.FILTER, "0.20,0.20,0.20,0.20,0.20");
iter.init(source, settings.getOptions(), SCAN_IE);
iter.seek(new Range(), EMPTY_COL_FAMS, true);
for (int i = 4; i < 100; i++) {
checkNextResult(iter, new double[] { i - 4, i - 3, i - 2, i - 1, i });
}
assertFalse(iter.hasTop());
}
示例3: testMultipleTimeSeriesMovingAverage
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
@Test
public void testMultipleTimeSeriesMovingAverage() throws Exception {
table.clear();
long ts = System.currentTimeMillis();
List<Tag> tags1 = new ArrayList<>();
tags1.add(new Tag("host", "r01n01"));
List<Tag> tags2 = new ArrayList<>();
tags2.add(new Tag("host", "r01n02"));
for (int i = 0; i < 100; i++) {
ts += 1000;
Metric m = new Metric("sys.cpu.user", ts, i * 1.0D, tags1);
byte[] row = MetricAdapter.encodeRowKey(m);
Key k = new Key(row, tags1.get(0).join().getBytes(StandardCharsets.UTF_8), new byte[0], new byte[0], ts);
Value v = new Value(MetricAdapter.encodeValue(m.getValue().getMeasure()));
table.put(k, v);
Metric m2 = new Metric("sys.cpu.user", ts, i * 2.0D, tags2);
byte[] row2 = MetricAdapter.encodeRowKey(m2);
Key k2 = new Key(row2, tags2.get(0).join().getBytes(StandardCharsets.UTF_8), new byte[0], new byte[0], ts);
Value v2 = new Value(MetricAdapter.encodeValue(m2.getValue().getMeasure()));
table.put(k2, v2);
}
SortedMapIterator source = new SortedMapIterator(table);
TimeSeriesGroupingIterator iter = new TimeSeriesGroupingIterator();
IteratorSetting settings = new IteratorSetting(100, TimeSeriesGroupingIterator.class);
settings.addOption(TimeSeriesGroupingIterator.FILTER, "0.20,0.20,0.20,0.20,0.20");
iter.init(source, settings.getOptions(), SCAN_IE);
iter.seek(new Range(), EMPTY_COL_FAMS, true);
for (int i = 4; i < 100; i++) {
checkNextResult(iter, new double[] { i - 4, i - 3, i - 2, i - 1, i });
checkNextResult(iter, new double[] { (i - 4) * 2, (i - 3) * 2, (i - 2) * 2, (i - 1) * 2, i * 2 });
}
assertFalse(iter.hasTop());
}
示例4: setBoundingBox
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
public static void setBoundingBox(IteratorSetting config, double north,
double east, double south, double west,
long startTime, long endTime) {
config.addOption("north", Double.toString(north));
config.addOption("east", Double.toString(east));
config.addOption("west", Double.toString(west));
config.addOption("south", Double.toString(south));
config.addOption("startTime", Long.toString(startTime));
config.addOption("endTime", Long.toString(endTime));
}
示例5: attachIterators
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
private void attachIterators(
final CommonIndexModel indexModel,
final String tablename,
final Connector connector )
throws AccumuloSecurityException,
AccumuloException,
TableNotFoundException {
final String modelString = ByteArrayUtils.byteArrayToString(PersistenceUtils.toBinary(indexModel));
final IteratorSetting decompSetting = new IteratorSetting(
FeatureCollectionDataAdapter.ARRAY_TO_ELEMENTS_PRIORITY,
ArrayToElementsIterator.class);
decompSetting.addOption(
ArrayToElementsIterator.MODEL,
modelString);
decompSetting.addOption(
TransformingIterator.MAX_BUFFER_SIZE_OPT,
Integer.toString(512000000));
connector.tableOperations().attachIterator(
tablename,
decompSetting,
EnumSet.of(IteratorScope.scan));
final IteratorSetting builderSetting = new IteratorSetting(
FeatureCollectionDataAdapter.ELEMENTS_TO_ARRAY_PRIORITY,
ElementsToArrayIterator.class);
builderSetting.addOption(
ElementsToArrayIterator.MODEL,
modelString);
builderSetting.addOption(
TransformingIterator.MAX_BUFFER_SIZE_OPT,
Integer.toString(512000000));
connector.tableOperations().attachIterator(
tablename,
builderSetting,
EnumSet.of(IteratorScope.scan));
}
示例6: attachIterators
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
public static void attachIterators(
final CommonIndexModel indexModel,
final String tablename,
final Connector connector )
throws AccumuloSecurityException,
AccumuloException,
TableNotFoundException {
final String modelString = ByteArrayUtils.byteArrayToString(PersistenceUtils.toBinary(indexModel));
final IteratorSetting decompSetting = new IteratorSetting(
FeatureCollectionDataAdapter.ARRAY_TO_ELEMENTS_PRIORITY,
ArrayToElementsIterator.class);
decompSetting.addOption(
ArrayToElementsIterator.MODEL,
modelString);
decompSetting.addOption(
TransformingIterator.MAX_BUFFER_SIZE_OPT,
Integer.toString(512000000));
connector.tableOperations().attachIterator(
tablename,
decompSetting,
EnumSet.of(IteratorScope.scan));
final IteratorSetting builderSetting = new IteratorSetting(
FeatureCollectionDataAdapter.ELEMENTS_TO_ARRAY_PRIORITY,
ElementsToArrayIterator.class);
builderSetting.addOption(
ElementsToArrayIterator.MODEL,
modelString);
builderSetting.addOption(
TransformingIterator.MAX_BUFFER_SIZE_OPT,
Integer.toString(512000000));
connector.tableOperations().attachIterator(
tablename,
builderSetting,
EnumSet.of(IteratorScope.scan));
}
示例7: addLabelsToSettings
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
private static void addLabelsToSettings(IteratorSetting settings, String settingPrefix, String[] labels) {
if (labels == null) {
return;
}
for (int i = 0; i < labels.length; i++) {
settings.addOption(settingPrefix + i, labels[i]);
}
}
示例8: setFilters
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
public static void setFilters(IteratorSetting settings, EnumSet<ElementFilter> filters) {
Set<String> filterStrings = new HashSet<>();
for (ElementFilter filter : filters) {
filterStrings.add(filter.name());
}
settings.addOption(SETTING_FILTERS, SetOfStringsEncoder.encodeToString(filterStrings));
}
示例9: setColumnFamilies
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
/**
* Encode the columns to be used when iterating.
*
* @param cfg
* @param columns
*/
public static void setColumnFamilies(final IteratorSetting cfg, final Text[] columns) {
if (columns.length < 2) {
throw new IllegalArgumentException("Must supply at least two terms to intersect");
}
cfg.addOption(AndingIterator.columnFamiliesOptionName, AndingIterator.encodeColumns(columns));
}
示例10: setDownsampleOptions
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
public static void setDownsampleOptions(IteratorSetting is, long start, long end, long period, String classname) {
is.addOption(START, "" + start);
is.addOption(END, "" + end);
is.addOption(PERIOD, "" + period);
is.addOption(AGGCLASS, classname);
}
示例11: setAggregationOptions
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
public static void setAggregationOptions(IteratorSetting is, Map<String, String> tags, String classname) {
is.addOption(TAGS, new TagListParser().combine(tags));
is.addOption(AGGCLASS, classname);
}
示例12: testTimeSeriesDropOff
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
@Test
public void testTimeSeriesDropOff() throws Exception {
table.clear();
long ts = System.currentTimeMillis();
List<Tag> tags1 = new ArrayList<>();
tags1.add(new Tag("host", "r01n01"));
List<Tag> tags2 = new ArrayList<>();
tags2.add(new Tag("host", "r01n02"));
for (int i = 0; i < 100; i++) {
ts += 1000;
Metric m = new Metric("sys.cpu.user", ts, i * 1.0D, tags1);
byte[] row = MetricAdapter.encodeRowKey(m);
Key k = new Key(row, tags1.get(0).join().getBytes(StandardCharsets.UTF_8), new byte[0], new byte[0], ts);
Value v = new Value(MetricAdapter.encodeValue(m.getValue().getMeasure()));
table.put(k, v);
if (i < 50) {
// only populate this series 50 times
Metric m2 = new Metric("sys.cpu.user", ts, i * 2.0D, tags2);
byte[] row2 = MetricAdapter.encodeRowKey(m2);
Key k2 = new Key(row2, tags2.get(0).join().getBytes(StandardCharsets.UTF_8), new byte[0], new byte[0],
ts);
Value v2 = new Value(MetricAdapter.encodeValue(m2.getValue().getMeasure()));
table.put(k2, v2);
}
}
SortedMapIterator source = new SortedMapIterator(table);
TimeSeriesGroupingIterator iter = new TimeSeriesGroupingIterator();
IteratorSetting settings = new IteratorSetting(100, TimeSeriesGroupingIterator.class);
settings.addOption(TimeSeriesGroupingIterator.FILTER, "0.20,0.20,0.20,0.20,0.20");
iter.init(source, settings.getOptions(), SCAN_IE);
iter.seek(new Range(), EMPTY_COL_FAMS, true);
for (int i = 4; i < 100; i++) {
System.out.println(i);
checkNextResult(iter, new double[] { i - 4, i - 3, i - 2, i - 1, i });
if (i < 50) {
checkNextResult(iter, new double[] { (i - 4) * 2, (i - 3) * 2, (i - 2) * 2, (i - 1) * 2, i * 2 });
}
}
assertFalse(iter.hasTop());
}
示例13: testAdditionalTimeSeries
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
@Test
public void testAdditionalTimeSeries() throws Exception {
table.clear();
long ts = System.currentTimeMillis();
List<Tag> tags1 = new ArrayList<>();
tags1.add(new Tag("host", "r01n01"));
List<Tag> tags2 = new ArrayList<>();
tags2.add(new Tag("host", "r01n02"));
for (int i = 0; i < 100; i++) {
ts += 1000;
Metric m = new Metric("sys.cpu.user", ts, i * 1.0D, tags1);
byte[] row = MetricAdapter.encodeRowKey(m);
Key k = new Key(row, tags1.get(0).join().getBytes(StandardCharsets.UTF_8), new byte[0], new byte[0], ts);
Value v = new Value(MetricAdapter.encodeValue(m.getValue().getMeasure()));
table.put(k, v);
if (i > 50) {
// only populate this series 50 times
Metric m2 = new Metric("sys.cpu.user", ts, i * 2.0D, tags2);
byte[] row2 = MetricAdapter.encodeRowKey(m2);
Key k2 = new Key(row2, tags2.get(0).join().getBytes(StandardCharsets.UTF_8), new byte[0], new byte[0],
ts);
Value v2 = new Value(MetricAdapter.encodeValue(m2.getValue().getMeasure()));
table.put(k2, v2);
}
}
SortedMapIterator source = new SortedMapIterator(table);
TimeSeriesGroupingIterator iter = new TimeSeriesGroupingIterator();
IteratorSetting settings = new IteratorSetting(100, TimeSeriesGroupingIterator.class);
settings.addOption(TimeSeriesGroupingIterator.FILTER, "0.20,0.20,0.20,0.20,0.20");
iter.init(source, settings.getOptions(), SCAN_IE);
iter.seek(new Range(), EMPTY_COL_FAMS, true);
for (int i = 4; i < 100; i++) {
checkNextResult(iter, new double[] { i - 4, i - 3, i - 2, i - 1, i });
if (i > 54) {
checkNextResult(iter, new double[] { (i - 4) * 2, (i - 3) * 2, (i - 2) * 2, (i - 1) * 2, i * 2 });
}
}
assertFalse(iter.hasTop());
}
示例14: testManySparseTimeSeries
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
@Test
public void testManySparseTimeSeries() throws Exception {
table.clear();
long ts = System.currentTimeMillis();
List<Tag> tags1 = new ArrayList<>();
tags1.add(new Tag("host", "r01n01"));
List<Tag> tags2 = new ArrayList<>();
tags2.add(new Tag("host", "r01n02"));
List<Tag> tags3 = new ArrayList<>();
tags3.add(new Tag("host", "r01n03"));
for (int i = 0; i < 100; i++) {
ts += 1000;
Metric m = new Metric("sys.cpu.user", ts, i * 1.0D, tags1);
byte[] row = MetricAdapter.encodeRowKey(m);
Key k = new Key(row, tags1.get(0).join().getBytes(StandardCharsets.UTF_8), new byte[0], new byte[0], ts);
Value v = new Value(MetricAdapter.encodeValue(m.getValue().getMeasure()));
table.put(k, v);
// jitter the time on the second time series
Metric m2 = new Metric("sys.cpu.user", ts + 50, i * 2.0D, tags2);
byte[] row2 = MetricAdapter.encodeRowKey(m2);
Key k2 = new Key(row2, tags2.get(0).join().getBytes(StandardCharsets.UTF_8), new byte[0], new byte[0],
ts + 50);
Value v2 = new Value(MetricAdapter.encodeValue(m2.getValue().getMeasure()));
table.put(k2, v2);
Metric m3 = new Metric("sys.cpu.user", ts, i * 3.0D, tags3);
byte[] row3 = MetricAdapter.encodeRowKey(m3);
Key k3 = new Key(row3, tags3.get(0).join().getBytes(StandardCharsets.UTF_8), new byte[0], new byte[0], ts);
Value v3 = new Value(MetricAdapter.encodeValue(m3.getValue().getMeasure()));
table.put(k3, v3);
}
SortedMapIterator source = new SortedMapIterator(table);
TimeSeriesGroupingIterator iter = new TimeSeriesGroupingIterator();
IteratorSetting settings = new IteratorSetting(100, TimeSeriesGroupingIterator.class);
settings.addOption(TimeSeriesGroupingIterator.FILTER, "0.20,0.20,0.20,0.20,0.20");
iter.init(source, settings.getOptions(), SCAN_IE);
iter.seek(new Range(), EMPTY_COL_FAMS, true);
LinkedList<Double> first = new LinkedList<>();
first.add(0D);
first.add(1D);
first.add(2D);
first.add(3D);
first.add(4D);
LinkedList<Double> second = new LinkedList<>();
second.add(0D);
second.add(2D);
second.add(4D);
second.add(6D);
second.add(8D);
LinkedList<Double> third = new LinkedList<>();
third.add(0D);
third.add(3D);
third.add(6D);
third.add(9D);
third.add(12D);
for (int i = 4; i < 196; i++) {
System.out.println(i);
if (i == 4) {
checkNextResult(iter, first);
checkNextResult(iter, third);
} else if (i == 5) {
checkNextResult(iter, second);
} else if (i % 2 == 0) {
shiftAndAdd(first, 1);
checkNextResult(iter, first);
shiftAndAdd(third, 3);
checkNextResult(iter, third);
} else if (i % 2 != 0) {
shiftAndAdd(second, 2);
checkNextResult(iter, second);
}
}
assertFalse(iter.hasTop());
}
示例15: setCutoff
import org.apache.accumulo.core.client.IteratorSetting; //导入方法依赖的package包/类
public static void setCutoff(IteratorSetting iterCfg, int cutoff) {
checkArgument(cutoff >= 0);
iterCfg.addOption("cutoff", cutoff + "");
}