@Test public void testScan() throws Exception { List<String> values = new ArrayList<String>(); values.add(millis("2012-01-24")); values.add(millis("2012-12-30")); List<String> results = lookupTable.scan("CAL_DT", values, "YEAR_BEG_DT"); Assert.assertTrue(results.size() > 0); for (String i : results) { System.out.println(i); Assert.assertEquals(millis("2012-01-01"), i); } }
public List<T> scan(String col, List<T> values, String returnCol) { ArrayList<T> result = new ArrayList<T>(); int colIdx = tableDesc.findColumnByName(col).getZeroBasedIndex(); int returnIdx = tableDesc.findColumnByName(returnCol).getZeroBasedIndex(); for (T[] row : data.values()) { if (values.contains(row[colIdx])) result.add(row[returnIdx]); } return result; }
LookupTable { public List<T> scan(String col, List<T> values, String returnCol) { ArrayList<T> result = new ArrayList<T>(); int colIdx = tableDesc.findColumnByName(col).getZeroBasedIndex(); int returnIdx = tableDesc.findColumnByName(returnCol).getZeroBasedIndex(); for (T[] row : data.values()) { if (values.contains(row[colIdx])) result.add(row[returnIdx]); } return result; } }
LookupTable { public List<T> scan(String col, List<T> values, String returnCol) { ArrayList<T> result = new ArrayList<T>(); int colIdx = tableDesc.findColumnByName(col).getZeroBasedIndex(); int returnIdx = tableDesc.findColumnByName(returnCol).getZeroBasedIndex(); for (T[] row : data.values()) { if (values.contains(row[colIdx])) result.add(row[returnIdx]); } return result; } LookupTable(TableDesc tableDesc, String[] keyColumns, IReadableTable table); }
LookupTable { public List<T> scan(String col, List<T> values, String returnCol) { ArrayList<T> result = new ArrayList<T>(); int colIdx = tableDesc.findColumnByName(col).getZeroBasedIndex(); int returnIdx = tableDesc.findColumnByName(returnCol).getZeroBasedIndex(); for (T[] row : data.values()) { if (values.contains(row[colIdx])) result.add(row[returnIdx]); } return result; } LookupTable(TableDesc tableDesc, String[] keyColumns, IReadableTable table); T[] getRow(Array<T> key); Collection<T[]> getAllRows(); List<T> scan(String col, List<T> values, String returnCol); Pair<T, T> mapRange(String col, T beginValue, T endValue, String returnCol); Set<T> mapValues(String col, Set<T> values, String returnCol); String toString(); abstract Class<?> getType(); void dump(); }
LookupTable { public List<T> scan(String col, List<T> values, String returnCol) { ArrayList<T> result = new ArrayList<T>(); int colIdx = tableDesc.findColumnByName(col).getZeroBasedIndex(); int returnIdx = tableDesc.findColumnByName(returnCol).getZeroBasedIndex(); for (T[] row : data.values()) { if (values.contains(row[colIdx])) result.add(row[returnIdx]); } return result; } LookupTable(TableDesc tableDesc, String[] keyColumns, IReadableTable table); T[] getRow(Array<T> key); Collection<T[]> getAllRows(); List<T> scan(String col, List<T> values, String returnCol); Pair<T, T> mapRange(String col, T beginValue, T endValue, String returnCol); Set<T> mapValues(String col, Set<T> values, String returnCol); String toString(); abstract Class<?> getType(); void dump();  }