use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class TestRecordBuffer method make.
private static RecordBuffer make(int n, int len) {
RecordBuffer rb = new RecordBuffer(recordFactory, len);
for (int i = 0; i < n; i++) {
Record r = RecordLib.intToRecord(2 * i + 2);
rb.add(r);
}
return rb;
}
use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class BPlusTreeRewriterUtils method printIndexBlocks.
static Iterator<Pair<Integer, Record>> printIndexBlocks(Iterator<Pair<Integer, Record>> iter2, BPTreeNodeMgr bptNodeMgr) {
divider();
List<Pair<Integer, Record>> pairs = Iter.toList(iter2);
System.out.printf(">>Packed index blocks\n");
for (Pair<Integer, Record> pair : pairs) {
System.out.printf(" %s\n", pair);
BPTreeNode bpNode = bptNodeMgr.getRead(pair.car(), BPlusTreeParams.RootParent);
bpNode.setIsLeaf(true);
System.out.printf("BPTreeNode: %d\n", bpNode.getId());
System.out.println(bpNode);
bptNodeMgr.release(bpNode);
}
System.out.printf("<<Packed index blocks\n");
return pairs.iterator();
}
use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class BPlusTreeRewriterUtils method printDataBlocks.
private static Iterator<Pair<Integer, Record>> printDataBlocks(Iterator<Pair<Integer, Record>> iter, RecordBufferPageMgr recordPageMgr) {
divider();
List<Pair<Integer, Record>> pairs = Iter.toList(iter);
System.out.printf(">>Packed data blocks\n");
for (Pair<Integer, Record> pair : pairs) {
System.out.printf(" %s\n", pair);
RecordBufferPage rbp = recordPageMgr.getRead(pair.car());
// System.out.printf("RecordBufferPage[id=%d,link=%d] %d\n",
// rbp.getId(), rbp.getLink(), rbp.getCount() );
System.out.println(rbp);
recordPageMgr.release(rbp);
}
System.out.printf("<<Packed data blocks\n");
System.out.printf("Blocks: %d\n", pairs.size());
return pairs.iterator();
}
use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class BPlusTreeRewriterUtils method summarizeIndexBlocks.
static Iterator<Pair<Integer, Record>> summarizeIndexBlocks(Iterator<Pair<Integer, Record>> iter2, BPTreeNodeMgr bptNodeMgr) {
divider();
List<Pair<Integer, Record>> pairs = Iter.toList(iter2);
for (Pair<Integer, Record> pair : pairs) {
BPTreeNode bpNode = bptNodeMgr.getRead(pair.car(), BPlusTreeParams.RootParent);
String hr = "null";
if (!bpNode.getRecordBuffer().isEmpty())
hr = bpNode.getRecordBuffer().getHigh().toString();
System.out.printf("%s -- BPTreeNode: %d (%d) -> [%s]\n", pair, bpNode.getId(), bpNode.getCount(), hr);
bptNodeMgr.release(bpNode);
}
return pairs.iterator();
}
use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class TestBPlusTreeRewriterNonTxn method runOneTest.
public 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 = TestBPlusTreeRewriterNonTxn.createData(N, recordFactory);
if (debug)
System.out.println("Test data: " + originaldata);
FileSet destination = FileSet.mem();
// ---- Rewrite
BufferChannel rootState = FileFactory.createBufferChannel(destination, Names.extBptState);
// Write leaves to ...
BlockMgr blkMgr1 = BlockMgrFactory.create(destination, Names.extBptTree, bptParams.getCalcBlockSize(), 10, 10);
// Write nodes to ...
BlockMgr blkMgr2 = BlockMgrFactory.create(destination, Names.extBptTree, bptParams.getCalcBlockSize(), 10, 10);
BPlusTree bpt2 = BPlusTreeRewriter.packIntoBPlusTree(originaldata.iterator(), bptParams, recordFactory, rootState, blkMgr1, blkMgr2);
if (debug) {
BPlusTreeRewriterUtils.divider();
bpt2.dump();
}
// ---- Checking
bpt2.check();
scanComparision(originaldata, bpt2);
findComparison(originaldata, bpt2);
sizeComparison(originaldata, bpt2);
}
Aggregations