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

Method getTupleDesc

src/java/simpledb/execution/SeqScan.java:112–124  ·  view source on GitHub ↗

Returns the TupleDesc with field names from the underlying HeapFile, prefixed with the tableAlias string from the constructor. This prefix becomes useful when joining tables containing a field(s) with the same name. The alias and name should be separated with a "." character (e.g., "alias.fieldName

()

Source from the content-addressed store, hash-verified

110 * prefixed with the tableAlias string from the constructor.
111 */
112 public TupleDesc getTupleDesc() {
113 // some code goes here
114 TupleDesc tupleDesc = Database.getCatalog().getDatabaseFile(this.tableId).getTupleDesc();
115 int itemLen = tupleDesc.getItemLength();
116 Type[] types = new Type[itemLen];
117 String[] fieldNames = new String[itemLen];
118 for(int i=0;i<itemLen;i++){
119 types[i] = tupleDesc.getFieldType(i);
120 fieldNames[i] = this.tableAlias +"."+ tupleDesc.getFieldName(i);
121 }
122
123 return new TupleDesc(types,fieldNames);
124 }
125
126 public boolean hasNext() throws TransactionAbortedException, DbException {
127 // some code goes here

Callers 1

testTupleDescMethod · 0.95

Calls 6

getCatalogMethod · 0.95
getItemLengthMethod · 0.95
getFieldTypeMethod · 0.95
getFieldNameMethod · 0.95
getTupleDescMethod · 0.65
getDatabaseFileMethod · 0.45

Tested by 1

testTupleDescMethod · 0.76