MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / reset

Method reset

src/java/simpledb/index/BTreeScan.java:86–107  ·  view source on GitHub ↗

Reset the tableid, and tableAlias of this operator. @param tableid the table to scan. @param tableAlias the alias of this table (needed by the parser); the returned tupleDesc should have fields with name tableAlias.fieldName (note: this class is not respon

(int tableid, String tableAlias)

Source from the content-addressed store, hash-verified

84 * tableAlias.null, or null.null).
85 */
86 public void reset(int tableid, String tableAlias) {
87 this.isOpen=false;
88 this.alias = tableAlias;
89 this.tablename = Database.getCatalog().getTableName(tableid);
90 if(ipred == null) {
91 this.it = Database.getCatalog().getDatabaseFile(tableid).iterator(tid);
92 }
93 else {
94 this.it = ((BTreeFile) Database.getCatalog().getDatabaseFile(tableid)).indexIterator(tid, ipred);
95 }
96 myTd = Database.getCatalog().getTupleDesc(tableid);
97 String[] newNames = new String[myTd.numFields()];
98 Type[] newTypes = new Type[myTd.numFields()];
99 for (int i = 0; i < myTd.numFields(); i++) {
100 String name = myTd.getFieldName(i);
101 Type t = myTd.getFieldType(i);
102
103 newNames[i] = tableAlias + "." + name;
104 newTypes[i] = t;
105 }
106 myTd = new TupleDesc(newTypes, newNames);
107 }
108
109 public BTreeScan(TransactionId tid, int tableid, IndexPredicate ipred) {
110 this(tid, tableid, Database.getCatalog().getTableName(tableid), ipred);

Callers 1

BTreeScanMethod · 0.95

Calls 9

getCatalogMethod · 0.95
iteratorMethod · 0.65
getTupleDescMethod · 0.65
getTableNameMethod · 0.45
getDatabaseFileMethod · 0.45
indexIteratorMethod · 0.45
numFieldsMethod · 0.45
getFieldNameMethod · 0.45
getFieldTypeMethod · 0.45

Tested by

no test coverage detected