@Test public void testNullRowSelection() throws Exception { executeCmd("delete from smalla"); executeCmd("insert into smalla (ROWID, LONGNUM, BIGINTEGERVALUE) values (1, null, 1)"); executeCmd("insert into smalla (ROWID, LONGNUM, BIGINTEGERVALUE) values (2, null, null)"); executeCmd("insert into smalla (ROWID, LONGNUM, BIGINTEGERVALUE) values (3, 3, null)"); executeCmd("insert into smalla (ROWID, LONGNUM, BIGINTEGERVALUE) values (4, 4, 4)"); AccumuloQueryExecution exec = (AccumuloQueryExecution) executeCmd( "select ROWID, LONGNUM, BIGINTEGERVALUE from smalla"); assertEquals(Arrays.asList(new Integer(1), null, new BigInteger("1")), exec.next()); assertEquals(Arrays.asList(new Integer(2), null, null), exec.next()); assertEquals(Arrays.asList(new Integer(3), new Long(3), null), exec.next()); assertEquals(Arrays.asList(new Integer(4), new Long(4), new BigInteger("4")), exec.next()); assertNull(exec.next()); exec = (AccumuloQueryExecution) executeCmd( "select LONGNUM from smalla"); ArrayList<?> NULL_ARRAY = new ArrayList(); NULL_ARRAY.add(null); assertEquals(NULL_ARRAY, exec.next()); assertEquals(NULL_ARRAY, exec.next()); assertEquals(Arrays.asList(new Long(3)), exec.next()); assertEquals(Arrays.asList(new Long(4)), exec.next()); assertNull(exec.next()); exec = (AccumuloQueryExecution) executeCmd( "select LONGNUM as foo from smalla"); assertEquals(NULL_ARRAY, exec.next()); assertEquals(NULL_ARRAY, exec.next()); assertEquals(Arrays.asList(new Long(3)), exec.next()); assertEquals(Arrays.asList(new Long(4)), exec.next()); assertNull(exec.next()); exec = (AccumuloQueryExecution) executeCmd( "select ROWID, LONGNUM as foo from smalla where LONGNUM is null"); assertEquals(Arrays.asList(new Integer(1), null), exec.next()); assertEquals(Arrays.asList(new Integer(2), null), 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();  }