public static Index buildIndexMem(RecordFactory recordFactory) { FileSet fileSet = FileSet.mem() ; return buildIndex(fileSet, recordFactory) ; }
public static RangeIndex buildRangeIndexMem(RecordFactory recordFactory) { FileSet fileSet = FileSet.mem() ; return buildRangeIndex(fileSet, recordFactory) ; }
@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 ; } }
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 ; }
static List<Record> createData2(int ORDER, int N, RecordFactory recordFactory) { // Use a B+Tree - so original data can be unsorted. BPlusTree bpt = SetupIndex.createBPTree(FileSet.mem(), ORDER, -1, -1, -1, recordFactory) ; //BPlusTreeParams.checkAll() ; // 200 -> runt leaf problem. // Problem is that a node in a stripe is less than half full // -> illegal BPT. // -> specially rebalance if 2 or more blocks. // -> spot one bloc (= root) // PeekIterator. for ( int i = 0; i < N ; i++ ) { Record record = recordFactory.create() ; Bytes.setInt(i+1, record.getKey()) ; bpt.add(record) ; } return Iter.toList(bpt.iterator()) ; }
static List<Record> createData2(int ORDER, int N, RecordFactory recordFactory) { // Use a B+Tree - so original data can be unsorted. BPlusTree bpt = SetupIndex.createBPTree(FileSet.mem(), ORDER, -1, -1, -1, recordFactory) ; //BPlusTreeParams.checkAll() ; // 200 -> runt leaf problem. // Problem is that a node in a stripe is less than half full // -> illegal BPT. // -> specially rebalance if 2 or more blocks. // -> spot one bloc (= root) // PeekIterator. for ( int i = 0; i < N ; i++ ) { Record record = recordFactory.create() ; Bytes.setInt(i+1, record.getKey()) ; bpt.add(record) ; } return Iter.toList(bpt.iterator()) ; }
static void runOneTest(int order, int N, RecordFactory recordFactory, boolean debug) { BPlusTreeParams bptParams = new BPlusTreeParams(order, recordFactory) ; BPlusTreeRewriter.debug = debug ; // ---- Test data List<Record> originaldata = TestBPlusTreeRewriter.createData(N, recordFactory) ; FileSet destination = FileSet.mem() ; // ---- Rewrite // Write leaves to ... BlockMgr blkMgr1 = BlockMgrFactory.create(destination, Names.bptExtTree, bptParams.getCalcBlockSize(), 10, 10) ; // Write nodes to ... BlockMgr blkMgr2 = BlockMgrFactory.create(destination, Names.bptExtTree, bptParams.getCalcBlockSize(), 10, 10) ; BPlusTree bpt2 = BPlusTreeRewriter.packIntoBPlusTree(originaldata.iterator(), bptParams, recordFactory, blkMgr1, blkMgr2) ; if ( debug ) { BPlusTreeRewriterUtils.divider() ; bpt2.dump(); } // ---- Checking bpt2.check() ; scanComparision(originaldata, bpt2) ; findComparison(originaldata, bpt2) ; sizeComparison(originaldata, bpt2) ; }
static void runOneTest(int order, int N, RecordFactory recordFactory, boolean debug) { BPlusTreeParams bptParams = new BPlusTreeParams(order, recordFactory) ; BPlusTreeRewriter.debug = debug ; // ---- Test data List<Record> originaldata = TestBPlusTreeRewriter.createData(N, recordFactory) ; FileSet destination = FileSet.mem() ; // ---- Rewrite // Write leaves to ... BlockMgr blkMgr1 = BlockMgrFactory.create(destination, Names.bptExtTree, bptParams.getCalcBlockSize(), 10, 10) ; // Write nodes to ... BlockMgr blkMgr2 = BlockMgrFactory.create(destination, Names.bptExtTree, bptParams.getCalcBlockSize(), 10, 10) ; BPlusTree bpt2 = BPlusTreeRewriter.packIntoBPlusTree(originaldata.iterator(), bptParams, recordFactory, blkMgr1, blkMgr2) ; if ( debug ) { BPlusTreeRewriterUtils.divider() ; bpt2.dump(); } // ---- Checking bpt2.check() ; scanComparision(originaldata, bpt2) ; findComparison(originaldata, bpt2) ; sizeComparison(originaldata, bpt2) ; }