protected TupleIndex makeTupleIndex(Location location, String name, String primary, String indexOrder, StoreParams params) { // Commonly, name == indexOrder. FileSet fs = new FileSet(location, name) ; ColumnMap colMap = new ColumnMap(primary, indexOrder) ; return /*tupleIndexBuilder.*/buildTupleIndex(fs, colMap, indexOrder, params) ; }
public static TupleIndex makeTupleIndex(Location location, String primary, String indexOrder, String indexName, int keyLength) { FileSet fs = new FileSet(location, indexName) ; int readCacheSize = params.getBlockReadCacheSize() ; int writeCacheSize = params.getBlockWriteCacheSize() ; // Value part is null (zero length) RangeIndex rIndex = SetupIndex.makeRangeIndex(location, indexName, params.getBlockSize(), keyLength, 0, readCacheSize, writeCacheSize) ; TupleIndex tupleIndex = new TupleIndexRecord(primary.length(), new ColumnMap(primary, indexOrder), indexOrder, rIndex.getRecordFactory(), rIndex) ; return tupleIndex ; }
return new TupleIndexRecord(desc.length(), new ColumnMap(primary, desc), desc, rf, rIndex) ;
@Test public void remap1() { ColumnMap x = new ColumnMap("SPO->POS", 2,0,1) ; // S->2 etc Integer[] array = {0,1,2 } ; assertEquals(Integer.valueOf(2), x.mapSlot(0, array) ) ; assertEquals(Integer.valueOf(0), x.mapSlot(1, array) ) ; assertEquals(Integer.valueOf(1), x.mapSlot(2, array) ) ; }
@Test public void remap2() { ColumnMap x = new ColumnMap("SPO->POS", 2,0,1) ; Integer[] array = { 0,1,2 } ; assertEquals(Integer.valueOf(1), x.fetchSlot(0, array)) ; // The index 1 comes from position 0. assertEquals(Integer.valueOf(2), x.fetchSlot(1, array)) ; assertEquals(Integer.valueOf(0), x.fetchSlot(2, array)) ; }
@Test public void remap2() { ColumnMap x = new ColumnMap("SPO->POS", 2,0,1) ; Integer[] array = { 0,1,2 } ; assertEquals(Integer.valueOf(1), x.fetchSlot(0, array)) ; // The index 1 comes from position 0. assertEquals(Integer.valueOf(2), x.fetchSlot(1, array)) ; assertEquals(Integer.valueOf(0), x.fetchSlot(2, array)) ; }
@Test public void remap1() { ColumnMap x = new ColumnMap("SPO->POS", 2,0,1) ; // S->2 etc Integer[] array = {0,1,2 } ; assertEquals(Integer.valueOf(2), x.mapSlot(0, array) ) ; assertEquals(Integer.valueOf(0), x.mapSlot(1, array) ) ; assertEquals(Integer.valueOf(1), x.mapSlot(2, array) ) ; }
static TupleIndexRecord create(String description) { IndexParams indexParams = StoreParams.getDftStoreParams() ; RangeIndex rIdx = IndexFactory.buildRangeIndex(FileSet.mem(), factory, indexParams) ; ColumnMap cmap = new ColumnMap("SPO", description) ; TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx) ; return index ; }
@Override protected TupleIndexRecord createIndex(String description) { IndexParams indexParams = StoreParams.getDftStoreParams() ; RangeIndex rIdx = IndexFactory.buildRangeIndex(FileSet.mem(), factory, indexParams) ; ColumnMap cmap = new ColumnMap("SPO", description) ; TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx) ; return index ; } }
static TupleIndexRecord create(String description) { IndexParams indexParams = StoreParams.getDftStoreParams() ; RangeIndex rIdx = IndexFactory.buildRangeIndex(FileSet.mem(), factory, indexParams) ; ColumnMap cmap = new ColumnMap("SPO", description) ; TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx) ; return index ; }
@Override protected TupleIndexRecord createIndex(String description) { IndexParams indexParams = StoreParams.getDftStoreParams() ; RangeIndex rIdx = IndexFactory.buildRangeIndex(FileSet.mem(), factory, indexParams) ; ColumnMap cmap = new ColumnMap("SPO", description) ; TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx) ; return index ; } }
@Test public void remap4() { ColumnMap x = new ColumnMap("POS", 2,0,1) ; Tuple<String> tuple = tuple("S", "P", "O") ; Tuple<String> tuple2 = x.map(tuple) ; tuple2 = x.unmap(tuple2) ; assertEquals(tuple, tuple2) ; }
@Test public void remap3() { ColumnMap x = new ColumnMap("POS", 2,0,1) ; Tuple<String> tuple = tuple("S", "P", "O") ; Tuple<String> mapped = x.map(tuple) ; Tuple<String> expected = tuple("P", "O", "S") ; assertEquals(expected, mapped) ; }
ColumnMap colMap = new ColumnMap(primaryOrder, indexName) ;
@Test public void remap3() { ColumnMap x = new ColumnMap("POS", 2,0,1) ; Tuple<String> tuple = tuple("S", "P", "O") ; Tuple<String> mapped = x.map(tuple) ; Tuple<String> expected = tuple("P", "O", "S") ; assertEquals(expected, mapped) ; }
@Test public void remap4() { ColumnMap x = new ColumnMap("POS", 2,0,1) ; Tuple<String> tuple = tuple("S", "P", "O") ; Tuple<String> tuple2 = x.map(tuple) ; tuple2 = x.unmap(tuple2) ; assertEquals(tuple, tuple2) ; }
@Test public void map1() { ColumnMap cmap = new ColumnMap("GSPO", "OSPG") ; Tuple<String> tuple = tuple("G", "S", "P", "O") ; Tuple<String> mapped = cmap.map(tuple) ; Tuple<String> expected = tuple("O", "S", "P", "G") ; assertEquals(expected, mapped) ; Tuple<String> unmapped = cmap.unmap(mapped) ; assertEquals(tuple("G", "S", "P", "O"), unmapped) ; }
@Test public void map2() { String[] x = { "G", "S", "P", "O" } ; String[] y = { "O", "S", "P", "G" } ; ColumnMap cmap = new ColumnMap("Test", x, y) ; Tuple<String> tuple = tuple(x) ; Tuple<String> mapped = cmap.map(tuple) ; Tuple<String> expected = tuple(y) ; assertEquals(expected, mapped) ; Tuple<String> unmapped = cmap.unmap(mapped) ; assertEquals(tuple(x), unmapped) ; }
@Test public void map2() { String[] x = { "G", "S", "P", "O" } ; String[] y = { "O", "S", "P", "G" } ; ColumnMap cmap = new ColumnMap("Test", x, y) ; Tuple<String> tuple = tuple(x) ; Tuple<String> mapped = cmap.map(tuple) ; Tuple<String> expected = tuple(y) ; assertEquals(expected, mapped) ; Tuple<String> unmapped = cmap.unmap(mapped) ; assertEquals(tuple(x), unmapped) ; }
@Test public void map1() { ColumnMap cmap = new ColumnMap("GSPO", "OSPG") ; Tuple<String> tuple = tuple("G", "S", "P", "O") ; Tuple<String> mapped = cmap.map(tuple) ; Tuple<String> expected = tuple("O", "S", "P", "G") ; assertEquals(expected, mapped) ; Tuple<String> unmapped = cmap.unmap(mapped) ; assertEquals(tuple("G", "S", "P", "O"), unmapped) ; }