@Test public void testINOnNonPKColumn() throws Exception { executeCmd("delete from customer"); executeCmd("insert into customer (customer_id, firstname, lastname) values (2, 'Joe', 'A')"); executeCmd("insert into customer (customer_id, firstname, lastname) values (1, 'John', 'B')"); executeCmd("insert into customer (customer_id, firstname, lastname) values (3, 'Jack', 'C')"); AccumuloQueryExecution exec = (AccumuloQueryExecution)executeCmd("select * from customer where " + "firstname IN('Joe', 'Jack') order by lastname"); assertEquals(Arrays.asList(2, "Joe", "A"), exec.next()); assertEquals(Arrays.asList(3, "Jack", "C"), exec.next()); assertNull(exec.next()); }
@Override public List<?> next() throws TranslatorException, DataNotAvailableException { SortedMap<Key, Value> rowItems = readNextRow(); boolean rowIdAdded = false; LinkedHashMap<String, byte[]> values = new LinkedHashMap<String, byte[]>(); for (Key key:rowItems.keySet()) { Text cf = key.getColumnFamily(); Text cq = key.getColumnQualifier(); Text rowid = key.getRow(); Value value = rowItems.get(key); Column match = findMatchingColumn(cf, cq); if (!rowIdAdded) { values.put(AccumuloMetadataProcessor.ROWID, rowid.getBytes()); rowIdAdded = true; } if (match != null) { String valueIn = match.getProperty(AccumuloMetadataProcessor.VALUE_IN, false); if (values.get(match.getName()) == null) { values.put(match.getName(), buildValue(valueIn, cq, value)); } } } return nextRow(values); }
AccumuloQueryExecution implements ResultSetExecution { @Override public List<?> next() throws TranslatorException, DataNotAvailableException { SortedMap<Key, Value> rowItems = readNextRow(); boolean rowIdAdded = false; LinkedHashMap<String, byte[]> values = new LinkedHashMap<String, byte[]>(); for (Key key:rowItems.keySet()) { Text cf = key.getColumnFamily(); Text cq = key.getColumnQualifier(); Text rowid = key.getRow(); Value value = rowItems.get(key); Column match = findMatchingColumn(cf, cq); if (!rowIdAdded) { values.put(AccumuloMetadataProcessor.ROWID, rowid.getBytes()); rowIdAdded = true; } if (match != null) { String valueIn = match.getProperty(AccumuloMetadataProcessor.VALUE_IN, false); if (values.get(match.getName()) == null) { values.put(match.getName(), buildValue(valueIn, cq, value)); } } } return nextRow(values); } }
AccumuloQueryExecution implements ResultSetExecution { @Override public List<?> next() throws TranslatorException, DataNotAvailableException { SortedMap<Key, Value> rowItems = readNextRow(); boolean rowIdAdded = false; LinkedHashMap<String, byte[]> values = new LinkedHashMap<String, byte[]>(); for (Key key:rowItems.keySet()) { Text cf = key.getColumnFamily(); Text cq = key.getColumnQualifier(); Text rowid = key.getRow(); Value value = rowItems.get(key); Column match = findMatchingColumn(cf, cq); if (!rowIdAdded) { values.put(AccumuloMetadataProcessor.ROWID, rowid.getBytes()); rowIdAdded = true; } if (match != null) { String valueIn = match.getProperty(AccumuloMetadataProcessor.VALUE_IN, false); if (values.get(match.getName()) == null) { values.put(match.getName(), buildValue(valueIn, cq, value)); } } } return nextRow(values); } AccumuloQueryExecution(AccumuloExecutionFactory aef, Select command,
            ExecutionContext executionContext,
            RuntimeMetadata metadata,
            AccumuloConnection connection); }
AccumuloQueryExecution implements ResultSetExecution { @Override public List<?> next() throws TranslatorException, DataNotAvailableException { SortedMap<Key, Value> rowItems = readNextRow(); boolean rowIdAdded = false; LinkedHashMap<String, byte[]> values = new LinkedHashMap<String, byte[]>(); for (Key key:rowItems.keySet()) { Text cf = key.getColumnFamily(); Text cq = key.getColumnQualifier(); Text rowid = key.getRow(); Value value = rowItems.get(key); Column match = findMatchingColumn(cf, cq); if (!rowIdAdded) { values.put(AccumuloMetadataProcessor.ROWID, rowid.getBytes()); rowIdAdded = true; } if (match != null) { String valueIn = match.getProperty(AccumuloMetadataProcessor.VALUE_IN, false); if (values.get(match.getName()) == null) { values.put(match.getName(), buildValue(valueIn, cq, value)); } } } return nextRow(values); } AccumuloQueryExecution(AccumuloExecutionFactory aef, Select command,
            ExecutionContext executionContext,
            RuntimeMetadata metadata,
            AccumuloConnection connection); @Override void execute(); @Override List<?> next(); @Override void close(); @Override void cancel(); }
AccumuloQueryExecution implements ResultSetExecution { @Override public List<?> next() throws TranslatorException, DataNotAvailableException { SortedMap<Key, Value> rowItems = readNextRow(); boolean rowIdAdded = false; LinkedHashMap<String, byte[]> values = new LinkedHashMap<String, byte[]>(); for (Key key:rowItems.keySet()) { Text cf = key.getColumnFamily(); Text cq = key.getColumnQualifier(); Text rowid = key.getRow(); Value value = rowItems.get(key); Column match = findMatchingColumn(cf, cq); if (!rowIdAdded) { values.put(AccumuloMetadataProcessor.ROWID, rowid.getBytes()); rowIdAdded = true; } if (match != null) { String valueIn = match.getProperty(AccumuloMetadataProcessor.VALUE_IN, false); if (values.get(match.getName()) == null) { values.put(match.getName(), buildValue(valueIn, cq, value)); } } } return nextRow(values); } AccumuloQueryExecution(AccumuloExecutionFactory aef, Select command,
            ExecutionContext executionContext,
            RuntimeMetadata metadata,
            AccumuloConnection connection); @Override void execute(); @Override List<?> next(); @Override void close(); @Override void cancel();  }