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
()
| 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 |