[关闭]
@w1024020103 2017-03-21T14:21:48.000000Z 字数 1335 阅读 489

Proj2 2.4. Insertion and deletion

CS61B


2.4. Insertion and deletion

Now that you have written all of the HeapFile machinery to add and remove tuples, you will implement the Insert and Delete operators.
For plans that implement insert and delete queries, the top-most operator is a special Insert or Delete operator that modifies the pages on disk. These operators return the number of affected tuples. This is implemented by returning a single tuple with one integer field, containing the count.
现在你已经写好了在HeapFile里添加和删除rows的工具,你将要实施Insert和Delete运算符.对于要执行插入和删除运算的命令,最顶端的运算符是用来修改磁盘上的pages的Insert和Delete运算符。这些运算符返回被影响的rows的数量。他们会返回一个单一的行,这一行包含了一个整数列,即我们要的该计数。

Insert: This operator adds the tuples it reads from its child operator to the tableid specified in its constructor. It should use the BufferPool.insertTuple() method to do this.
Delete: This operator deletes the tuples it reads from its child operator from the tableid specified in its constructor. It should use the BufferPool.deleteTuple() method to do this.
插入:这个运算符会把从它的子运算符读取的rows添加到它的构造器制定的tableid里。应该用 BufferPool.insertTuple()来完成。
删除:这个运算符将会从它的构造器制定的tableid删除掉它从自己的子运算符读取的rows.应该用BufferPool.deleteTuple()来完成。

Exercise 4. Implement the skeleton methods in:
src/simpledb/Insert.java
src/simpledb/Delete.java
At this point, your code should pass the unit tests in InsertTest. We have not provided unit tests for Delete. Furthermore, you should be able to pass the InsertTest and DeleteTest system tests.

因为Proj2不要求实现Delete功能,所以就先不写了,精力留到后面调整细节来满足Proj2的要求吧!

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注