Java Code Examples for org.apache.accumulo.core.client.Instance#getConnector()
The following examples show how to use
org.apache.accumulo.core.client.Instance#getConnector() .
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: ConnectorPool.java From geowave with Apache License 2.0 | 6 votes |
public synchronized Connector getConnector( final String zookeeperUrl, final String instanceName, final String userName, final String password) throws AccumuloException, AccumuloSecurityException { final ConnectorConfig config = new ConnectorConfig(zookeeperUrl, instanceName, userName, password); Connector connector = connectorCache.get(config); if (connector == null) { final Instance inst = new ZooKeeperInstance(instanceName, zookeeperUrl); connector = inst.getConnector(userName, password); connectorCache.put(config, connector); } return connector; }
Example 2
Source File: DataStore.java From qonduit with Apache License 2.0 | 6 votes |
public DataStore(Configuration conf) throws QonduitException { try { final HashMap<String, String> apacheConf = new HashMap<>(); Configuration.Accumulo accumuloConf = conf.getAccumulo(); apacheConf.put("instance.name", accumuloConf.getInstanceName()); apacheConf.put("instance.zookeeper.host", accumuloConf.getZookeepers()); final ClientConfiguration aconf = ClientConfiguration.fromMap(apacheConf); final Instance instance = new ZooKeeperInstance(aconf); connector = instance.getConnector(accumuloConf.getUsername(), new PasswordToken(accumuloConf.getPassword())); } catch (Exception e) { throw new QonduitException(HttpResponseStatus.INTERNAL_SERVER_ERROR.code(), "Error creating DataStoreImpl", e.getMessage(), e); } }
Example 3
Source File: GetMetricTableSplitPoints.java From timely with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { try (ConfigurableApplicationContext ctx = new SpringApplicationBuilder(SpringBootstrap.class) .bannerMode(Mode.OFF).web(WebApplicationType.NONE).run(args)) { Configuration conf = ctx.getBean(Configuration.class); final Map<String, String> properties = new HashMap<>(); Accumulo accumuloConf = conf.getAccumulo(); properties.put("instance.name", accumuloConf.getInstanceName()); properties.put("instance.zookeeper.host", accumuloConf.getZookeepers()); final ClientConfiguration aconf = ClientConfiguration.fromMap(properties); final Instance instance = new ZooKeeperInstance(aconf); Connector con = instance.getConnector(accumuloConf.getUsername(), new PasswordToken(accumuloConf.getPassword())); Scanner s = con.createScanner(conf.getMetaTable(), con.securityOperations().getUserAuthorizations(con.whoami())); try { s.setRange(new Range(Meta.METRIC_PREFIX, true, Meta.TAG_PREFIX, false)); for (Entry<Key, Value> e : s) { System.out.println(e.getKey().getRow().toString().substring(Meta.METRIC_PREFIX.length())); } } finally { s.close(); } } }
Example 4
Source File: TabletMetadataConsole.java From timely with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { try (ConfigurableApplicationContext ctx = new SpringApplicationBuilder(SpringBootstrap.class) .bannerMode(Banner.Mode.OFF).web(WebApplicationType.NONE).run(args)) { Configuration conf = ctx.getBean(Configuration.class); HashMap<String, String> apacheConf = new HashMap<>(); Accumulo accumuloConf = conf.getAccumulo(); apacheConf.put("instance.name", accumuloConf.getInstanceName()); apacheConf.put("instance.zookeeper.host", accumuloConf.getZookeepers()); ClientConfiguration aconf = ClientConfiguration.fromMap(apacheConf); Instance instance = new ZooKeeperInstance(aconf); Connector con = instance.getConnector(accumuloConf.getUsername(), new PasswordToken(accumuloConf.getPassword())); TabletMetadataQuery query = new TabletMetadataQuery(con, conf.getMetricsTable()); TabletMetadataView view = query.run(); System.out.println(view.toText(TimeUnit.DAYS)); } }
Example 5
Source File: ArbitraryLengthQueryTest.java From rya with Apache License 2.0 | 6 votes |
public MockRdfCloudStore() { super(); final Instance instance = new MockInstance(); try { final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration(); setConf(conf); final Connector connector = instance.getConnector("", ""); final AccumuloRyaDAO cdao = new AccumuloRyaDAO(); cdao.setConf(conf); cdao.setConnector(connector); setRyaDAO(cdao); inferenceEngine = new InferenceEngine(); inferenceEngine.setRyaDAO(cdao); inferenceEngine.setRefreshGraphSchedule(5000); //every 5 sec inferenceEngine.setConf(conf); setInferenceEngine(inferenceEngine); } catch (final Exception e) { e.printStackTrace(); } }
Example 6
Source File: AccumuloConnector.java From mrgeo with Apache License 2.0 | 6 votes |
public static synchronized Connector getConnector(String instance, String zookeepers, String user, String pass) throws DataProviderException { if (conn != null) { return conn; } if (checkMock()) { return getMockConnector(instance, user, pass); } Instance inst = new ZooKeeperInstance(instance, zookeepers); try { conn = inst.getConnector(user, new PasswordToken(pass.getBytes())); return conn; } catch (Exception e) { throw new DataProviderException("problem creating connector", e); } }
Example 7
Source File: FluoITBase.java From rya with Apache License 2.0 | 5 votes |
@BeforeClass public static void beforeClass() throws Exception { Logger.getLogger(ClientCnxn.class).setLevel(Level.ERROR); // Setup and start the Mini Accumulo. cluster = clusterInstance.getCluster(); // Store a connector to the Mini Accumulo. instanceName = cluster.getInstanceName(); zookeepers = cluster.getZooKeepers(); final Instance instance = new ZooKeeperInstance(instanceName, zookeepers); accumuloConn = instance.getConnector(clusterInstance.getUsername(), new PasswordToken(clusterInstance.getPassword())); }
Example 8
Source File: AccumuloModule.java From presto with Apache License 2.0 | 5 votes |
@Override public Connector get() { try { Instance inst = new ZooKeeperInstance(instance, zooKeepers); Connector connector = inst.getConnector(username, new PasswordToken(password.getBytes(UTF_8))); LOG.info("Connection to instance %s at %s established, user %s", instance, zooKeepers, username); return connector; } catch (AccumuloException | AccumuloSecurityException e) { throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to get connector to Accumulo", e); } }
Example 9
Source File: AccumuloIndexSetColumnVisibilityTest.java From rya with Apache License 2.0 | 5 votes |
private static MiniAccumuloCluster startMiniAccumulo() throws IOException, InterruptedException, AccumuloException, AccumuloSecurityException { final File miniDataDir = Files.createTempDir(); // Setup and start the Mini Accumulo. final MiniAccumuloCluster accumulo = new MiniAccumuloCluster( miniDataDir, "password"); accumulo.start(); // Store a connector to the Mini Accumulo. final Instance instance = new ZooKeeperInstance( accumulo.getInstanceName(), accumulo.getZooKeepers()); accCon = instance.getConnector("root", new PasswordToken("password")); return accumulo; }
Example 10
Source File: AccumuloGeoSpatialStoreTest.java From accumulo-recipes with Apache License 2.0 | 5 votes |
@Before public void setUp() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException { Instance instance = new MockInstance(); connector = instance.getConnector("root", "".getBytes()); store = new AccumuloGeoSpatialStore(connector); }
Example 11
Source File: PeriodicBindingSetExporterFactory.java From rya with Apache License 2.0 | 5 votes |
@Override public Optional<IncrementalResultExporter> build(Context context) throws IncrementalExporterFactoryException, ConfigurationException { checkNotNull(context); // Wrap the context's parameters for parsing. final RyaExportParameters params = new RyaExportParameters( context.getObserverConfiguration().toMap() ); if(params.getUsePeriodicBindingSetExporter()) { // Setup Zookeeper connection info. final String accumuloInstance = params.getAccumuloInstanceName().get(); final String zookeeperServers = params.getZookeeperServers().get().replaceAll(";", ","); final Instance inst = new ZooKeeperInstance(accumuloInstance, zookeeperServers); try { // Setup Accumulo connection info. final String exporterUsername = params.getExporterUsername().get(); final String exporterPassword = params.getExporterPassword().get(); final Connector accumuloConn = inst.getConnector(exporterUsername, new PasswordToken(exporterPassword)); // Setup Rya PCJ Storage. final String ryaInstanceName = params.getRyaInstanceName().get(); final PeriodicQueryResultStorage periodicStorage = new AccumuloPeriodicQueryResultStorage(accumuloConn, ryaInstanceName); // Make the exporter. final IncrementalBindingSetExporter exporter = new PeriodicBindingSetExporter(periodicStorage); return Optional.of(exporter); } catch (final AccumuloException | AccumuloSecurityException e) { throw new IncrementalExporterFactoryException("Could not initialize the Accumulo connector using the provided configuration.", e); } } else { return Optional.absent(); } }
Example 12
Source File: AccumuloHDFSFileInputFormat.java From rya with Apache License 2.0 | 5 votes |
@Override public List<InputSplit> getSplits(JobContext jobContext) throws IOException { //read the params from AccumuloInputFormat Configuration conf = jobContext.getConfiguration(); Instance instance = MRUtils.AccumuloProps.getInstance(jobContext); String user = MRUtils.AccumuloProps.getUsername(jobContext); AuthenticationToken password = MRUtils.AccumuloProps.getPassword(jobContext); String table = MRUtils.AccumuloProps.getTablename(jobContext); ArgumentChecker.notNull(instance); ArgumentChecker.notNull(table); //find the files necessary try { Connector connector = instance.getConnector(user, password); TableOperations tos = connector.tableOperations(); String tableId = tos.tableIdMap().get(table); Scanner scanner = connector.createScanner("accumulo.metadata", Authorizations.EMPTY); //TODO: auths? scanner.setRange(new Range(new Text(tableId + "\u0000"), new Text(tableId + "\uFFFD"))); scanner.fetchColumnFamily(new Text("file")); List<String> files = new ArrayList<String>(); List<InputSplit> fileSplits = new ArrayList<InputSplit>(); for (Map.Entry<Key, Value> entry : scanner) { String file = entry.getKey().getColumnQualifier().toString(); Path path = new Path(file); FileSystem fs = path.getFileSystem(conf); FileStatus fileStatus = fs.getFileStatus(path); long len = fileStatus.getLen(); BlockLocation[] fileBlockLocations = fs.getFileBlockLocations(fileStatus, 0, len); files.add(file); fileSplits.add(new FileSplit(path, 0, len, fileBlockLocations[0].getHosts())); } System.out.println(files); return fileSplits; } catch (Exception e) { throw new IOException(e); } }
Example 13
Source File: PcjTablesWithMockTest.java From rya with Apache License 2.0 | 5 votes |
@Before public void init() throws AccumuloException, AccumuloSecurityException, RepositoryException { Instance instance = new MockInstance("instance"); accumuloConn = instance.getConnector("root", new PasswordToken("")); ryaRepo = setupRya(accumuloConn); ryaConn = ryaRepo.getConnection(); }
Example 14
Source File: EventGlobalIndexVisitorTest.java From accumulo-recipes with Apache License 2.0 | 4 votes |
@Test public void test() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException { Instance instance = new MockInstance(); Connector connector = instance.getConnector("root", "".getBytes()); EventStore eventStore = new AccumuloEventStore(connector); Event event = EventBuilder.create("", "id", System.currentTimeMillis()) .attr(new Attribute("key1", "val1")) .attr(new Attribute("key2", "val2")).build(); Event event2 = EventBuilder.create("", "id2", System.currentTimeMillis()) .attr(new Attribute("key1", "val1")) .attr(new Attribute("key2", "val2")) .attr(new Attribute("key3", true)).build(); eventStore.save(asList(new Event[]{event, event2})); dumpTable(connector, DEFAULT_IDX_TABLE_NAME); Node node = QueryBuilder.create().and().eq("key1", "val1").eq("key2", "val2").eq("key3", true).end().build(); BatchScanner scanner = connector.createBatchScanner(DEFAULT_IDX_TABLE_NAME, new Authorizations(), 2); GlobalIndexVisitor visitor = new EventGlobalIndexVisitor(new Date(0), new Date(), Collections.singleton(""), scanner, new DailyShardBuilder(Constants.DEFAULT_PARTITION_SIZE)); node.accept(visitor); visitor.exec(); assertEquals(3, visitor.getCardinalities().size()); for (Map.Entry<AttributeIndexKey, Long> entry : visitor.getCardinalities().entrySet()) { if (entry.getKey().getKey().equals("key1")) assertEquals(2l, (long) entry.getValue()); else if (entry.getKey().getKey().equals("key2")) assertEquals(2l, (long) entry.getValue()); else if (entry.getKey().getKey().equals("key3")) assertEquals(1l, (long) entry.getValue()); else throw new RuntimeException("Unexpected key in cardinalities"); } }
Example 15
Source File: EventKeyValueIndexTest.java From accumulo-recipes with Apache License 2.0 | 4 votes |
@Test public void testUniqueValues() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException { Instance instance = new MockInstance(); Connector connector = instance.getConnector("root", "".getBytes()); EventStore eventStore = new AccumuloEventStore(connector); KeyValueIndex eventKeyValueIndex = new KeyValueIndex( connector, "eventStore_index", DEFAULT_SHARD_BUILDER, DEFAULT_STORE_CONFIG, LEXI_TYPES ); Event event = EventBuilder.create("type1", "id", 0) .attr(new Attribute("key1", "val1")) .attr(new Attribute("key2", "val2")).build(); Event event1 = EventBuilder.create("type1", "id", 0) .attr(new Attribute("key1", "theVal1")) .attr(new Attribute("key2", "aVal")).build(); Event event2 = EventBuilder.create("type2", "id2", 0) .attr(new Attribute("key1", "val1")) .attr(new Attribute("key2", "val2")) .attr(new Attribute("key3", true)) .attr(new Attribute("aKey", 1)).build(); eventStore.save(Arrays.asList(new Event[] {event, event1, event2})); dumpTable(connector, DEFAULT_IDX_TABLE_NAME); /** * Test with prefix which contains value */ CloseableIterable<Object> types = eventKeyValueIndex.uniqueValuesForKey("v", "type1", "string", "key1", Auths.EMPTY); assertEquals(1, Iterables.size(types)); assertEquals("val1", Iterables.get(types, 0)); /** * Test with prefix that does not contain value */ types = eventKeyValueIndex.uniqueValuesForKey("a", "type1", "string", "key1", Auths.EMPTY); assertEquals(0, Iterables.size(types)); /** * Test with no prefix */ types = eventKeyValueIndex.uniqueValuesForKey("", "type1", "string", "key2", Auths.EMPTY); assertEquals(2, Iterables.size(types)); assertEquals("aVal", Iterables.get(types, 0)); assertEquals("val2", Iterables.get(types, 1)); }
Example 16
Source File: FirstEntryInPrefixedRowTest.java From accumulo-recipes with Apache License 2.0 | 4 votes |
@Before public void setUp() throws AccumuloSecurityException, AccumuloException, TableExistsException { Instance instance = new MockInstance(); connector = instance.getConnector("user", "".getBytes()); connector.tableOperations().create("test"); }
Example 17
Source File: AccumuloMutationProcessor.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("unchecked") public void setConf(Configuration config) { this.conf = config; // Get the implementation of MutationTransformer to use. // By default, we call toString() on every non-null field. Class<? extends MutationTransformer> xformerClass = (Class<? extends MutationTransformer>) this.conf.getClass(AccumuloConstants.TRANSFORMER_CLASS_KEY, ToStringMutationTransformer.class); this.mutationTransformer = (MutationTransformer) ReflectionUtils.newInstance(xformerClass, this.conf); if (null == mutationTransformer) { throw new RuntimeException("Could not instantiate MutationTransformer."); } String colFam = conf.get(AccumuloConstants.COL_FAMILY_KEY, null); if (null == colFam) { throw new RuntimeException("Accumulo column family not set."); } this.mutationTransformer.setColumnFamily(colFam); String rowKey = conf.get(AccumuloConstants.ROW_KEY_COLUMN_KEY, null); if (null == rowKey) { throw new RuntimeException("Row key column not set."); } this.mutationTransformer.setRowKeyColumn(rowKey); String vis = conf.get(AccumuloConstants.VISIBILITY_KEY, null); this.mutationTransformer.setVisibility(vis); this.tableName = conf.get(AccumuloConstants.TABLE_NAME_KEY, null); String zookeeper = conf.get(AccumuloConstants.ZOOKEEPERS); String instance = conf.get(AccumuloConstants.ACCUMULO_INSTANCE); Instance inst = new ZooKeeperInstance(instance, zookeeper); String username = conf.get(AccumuloConstants.ACCUMULO_USER_NAME); String pw = conf.get(AccumuloConstants.ACCUMULO_PASSWORD); if (null == pw) { pw = ""; } byte[] password = pw.getBytes(); BatchWriterConfig bwc = new BatchWriterConfig(); long bs = conf.getLong(AccumuloConstants.BATCH_SIZE, AccumuloConstants.DEFAULT_BATCH_SIZE); bwc.setMaxMemory(bs); long la = conf.getLong(AccumuloConstants.MAX_LATENCY, AccumuloConstants.DEFAULT_LATENCY); bwc.setMaxLatency(la, TimeUnit.MILLISECONDS); try { Connector conn = inst.getConnector(username, new PasswordToken(password)); this.table = conn.createBatchWriter(tableName, bwc); } catch (AccumuloException ex) { throw new RuntimeException("Error accessing Accumulo", ex); } catch (AccumuloSecurityException aex){ throw new RuntimeException("Security exception accessing Accumulo", aex); } catch(TableNotFoundException tex){ throw new RuntimeException("Accumulo table " + tableName + " not found", tex); } }
Example 18
Source File: EntityGlobalIndexVisitorTest.java From accumulo-recipes with Apache License 2.0 | 4 votes |
@Test public void test() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException { Instance instance = new MockInstance(); Connector connector = instance.getConnector("root", new PasswordToken("".getBytes())); EntityStore entityStore = new AccumuloEntityStore(connector); Entity entity = EntityBuilder.create("type", "id") .attr(new Attribute("key1", "val1")) .attr(new Attribute("key2", "val2")) .build(); Entity entity2 = EntityBuilder.create("type", "id2") .attr(new Attribute("key1", "val1")) .attr(new Attribute("key2", "val2")) .attr(new Attribute("key3", true)) .build(); entityStore.save(asList(new Entity[]{entity, entity2})); dumpTable(connector, DEFAULT_IDX_TABLE_NAME); Node node = QueryBuilder.create().and().eq("key1", "val1").eq("key2", "val2").eq("key3", true).end().build(); BatchScanner scanner = connector.createBatchScanner(DEFAULT_IDX_TABLE_NAME, new Authorizations(), 2); GlobalIndexVisitor visitor = new EntityGlobalIndexVisitor(scanner, new EntityShardBuilder(DEFAULT_PARTITION_SIZE), Collections.singleton("type")); node.accept(visitor); visitor.exec(); assertEquals(3, visitor.getCardinalities().size()); for (Map.Entry<AttributeIndexKey, Long> entry : visitor.getCardinalities().entrySet()) { if (entry.getKey().getKey().equals("key1")) assertEquals(2l, (long) entry.getValue()); else if (entry.getKey().getKey().equals("key2")) assertEquals(2l, (long) entry.getValue()); else if (entry.getKey().getKey().equals("key3")) assertEquals(1l, (long) entry.getValue()); else throw new RuntimeException("Unexpected key in cardinalities"); } }
Example 19
Source File: BulkInputFormat.java From datawave with Apache License 2.0 | 4 votes |
/** * Initialize a scanner over the given input split using this task attempt configuration. */ public void initialize(InputSplit inSplit, TaskAttemptContext attempt) throws IOException { if (null != scanner) { scanner.close(); } split = (RangeSplit) inSplit; if (log.isDebugEnabled()) log.debug("Initializing input split: " + split.getRanges()); Configuration conf = attempt.getConfiguration(); Instance instance = getInstance(conf); String user = getUsername(conf); byte[] password = getPassword(conf); Authorizations authorizations = getAuthorizations(conf); try { log.debug("Creating connector with user: " + user); Connector conn = instance.getConnector(user, new PasswordToken(password)); log.debug("Creating scanner for table: " + getTablename(conf)); log.debug("Authorizations are: " + authorizations); scanner = conn.createBatchScanner(getTablename(conf), authorizations, 2); setupMaxVersions(conf, scanner); IteratorSetting is = new IteratorSetting(50, RegExFilter.class); RegExFilter.setRegexs(is, conf.get(ROW_REGEX), conf.get(COLUMN_FAMILY_REGEX), conf.get(COLUMN_QUALIFIER_REGEX), null, false); scanner.addScanIterator(is); setupIterators(conf, scanner); } catch (Exception e) { throw new IOException(e); } // setup a scanner within the bounds of this split for (Pair<Text,Text> c : getFetchedColumns(conf)) { if (c.getSecond() != null) { log.debug("Fetching column " + c.getFirst() + ":" + c.getSecond()); scanner.fetchColumn(c.getFirst(), c.getSecond()); } else { log.debug("Fetching column family " + c.getFirst()); scanner.fetchColumnFamily(c.getFirst()); } } scanner.setRanges(split.getRanges()); numKeysRead = -1; // do this last after setting all scanner options scannerIterator = scanner.iterator(); }
Example 20
Source File: TestIndexer.java From presto with Apache License 2.0 | 4 votes |
@Test public void testMutationIndex() throws Exception { Instance inst = new MockInstance(); Connector conn = inst.getConnector("root", new PasswordToken("")); conn.tableOperations().create(table.getFullTableName()); conn.tableOperations().create(table.getIndexTableName()); conn.tableOperations().create(table.getMetricsTableName()); for (IteratorSetting s : Indexer.getMetricIterators(table)) { conn.tableOperations().attachIterator(table.getMetricsTableName(), s); } Indexer indexer = new Indexer(conn, new Authorizations(), table, new BatchWriterConfig()); indexer.index(m1); indexer.flush(); Scanner scan = conn.createScanner(table.getIndexTableName(), new Authorizations()); scan.setRange(new Range()); Iterator<Entry<Key, Value>> iter = scan.iterator(); assertKeyValuePair(iter.next(), AGE_VALUE, "cf_age", "row1", ""); assertKeyValuePair(iter.next(), bytes("abc"), "cf_arr", "row1", ""); assertKeyValuePair(iter.next(), M1_FNAME_VALUE, "cf_firstname", "row1", ""); assertKeyValuePair(iter.next(), bytes("def"), "cf_arr", "row1", ""); assertKeyValuePair(iter.next(), bytes("ghi"), "cf_arr", "row1", ""); assertFalse(iter.hasNext()); scan.close(); scan = conn.createScanner(table.getMetricsTableName(), new Authorizations()); scan.setRange(new Range()); iter = scan.iterator(); assertKeyValuePair(iter.next(), AGE_VALUE, "cf_age", "___card___", "1"); assertKeyValuePair(iter.next(), Indexer.METRICS_TABLE_ROW_ID.array(), "___rows___", "___card___", "1"); assertKeyValuePair(iter.next(), Indexer.METRICS_TABLE_ROW_ID.array(), "___rows___", "___first_row___", "row1"); assertKeyValuePair(iter.next(), Indexer.METRICS_TABLE_ROW_ID.array(), "___rows___", "___last_row___", "row1"); assertKeyValuePair(iter.next(), bytes("abc"), "cf_arr", "___card___", "1"); assertKeyValuePair(iter.next(), M1_FNAME_VALUE, "cf_firstname", "___card___", "1"); assertKeyValuePair(iter.next(), bytes("def"), "cf_arr", "___card___", "1"); assertKeyValuePair(iter.next(), bytes("ghi"), "cf_arr", "___card___", "1"); assertFalse(iter.hasNext()); scan.close(); indexer.index(m2); indexer.close(); scan = conn.createScanner(table.getIndexTableName(), new Authorizations()); scan.setRange(new Range()); iter = scan.iterator(); assertKeyValuePair(iter.next(), AGE_VALUE, "cf_age", "row1", ""); assertKeyValuePair(iter.next(), AGE_VALUE, "cf_age", "row2", ""); assertKeyValuePair(iter.next(), bytes("abc"), "cf_arr", "row1", ""); assertKeyValuePair(iter.next(), bytes("abc"), "cf_arr", "row2", ""); assertKeyValuePair(iter.next(), M1_FNAME_VALUE, "cf_firstname", "row1", ""); assertKeyValuePair(iter.next(), M2_FNAME_VALUE, "cf_firstname", "row2", ""); assertKeyValuePair(iter.next(), bytes("def"), "cf_arr", "row1", ""); assertKeyValuePair(iter.next(), bytes("ghi"), "cf_arr", "row1", ""); assertKeyValuePair(iter.next(), bytes("ghi"), "cf_arr", "row2", ""); assertKeyValuePair(iter.next(), bytes("mno"), "cf_arr", "row2", ""); assertFalse(iter.hasNext()); scan.close(); scan = conn.createScanner(table.getMetricsTableName(), new Authorizations()); scan.setRange(new Range()); iter = scan.iterator(); assertKeyValuePair(iter.next(), AGE_VALUE, "cf_age", "___card___", "2"); assertKeyValuePair(iter.next(), Indexer.METRICS_TABLE_ROW_ID.array(), "___rows___", "___card___", "2"); assertKeyValuePair(iter.next(), Indexer.METRICS_TABLE_ROW_ID.array(), "___rows___", "___first_row___", "row1"); assertKeyValuePair(iter.next(), Indexer.METRICS_TABLE_ROW_ID.array(), "___rows___", "___last_row___", "row2"); assertKeyValuePair(iter.next(), bytes("abc"), "cf_arr", "___card___", "2"); assertKeyValuePair(iter.next(), M1_FNAME_VALUE, "cf_firstname", "___card___", "1"); assertKeyValuePair(iter.next(), M2_FNAME_VALUE, "cf_firstname", "___card___", "1"); assertKeyValuePair(iter.next(), bytes("def"), "cf_arr", "___card___", "1"); assertKeyValuePair(iter.next(), bytes("ghi"), "cf_arr", "___card___", "2"); assertKeyValuePair(iter.next(), bytes("mno"), "cf_arr", "___card___", "1"); assertFalse(iter.hasNext()); scan.close(); }