Can anyone explain why DDLTask creates WriteEntity objects after the operation 
completes?

Here is 1 concrete example (of many):


private void dropTable(Hive db, Table tbl, DropTableDesc dropTbl) throws 
HiveException {

//bunch of stuff omitted

  // drop the table
  db.dropTable(dropTbl.getTableName(), dropTbl.getIfPurge());
  if (tbl != null) {
    // We have already locked the table in DDLSemanticAnalyzer, don't do it 
again here
    work.getOutputs().add(new WriteEntity(tbl, 
WriteEntity.WriteType.DDL_NO_LOCK));
  }
}


DDLSemanticAnalyzer.analyzeDropTable() has already added a WriteEntity for this 
table object,

so the effect of adding another one with the same name, replaces one with the 
new one since the collection that

contains them is a Set and WriteEntity.equals() only pays attention to the name 
 (I.e. db@table@partition).

(This collection is the same object as you get from QueryPlan.getOutputs())


What useful semantics does this have?

What could the intent have been?


Thanks,

Eugene

Reply via email to