private Long allocateTableWriteId(TableName tableName, Long defaultValue) throws SemanticException {
    if (ctx.getExplainConfig() != null) {
      return defaultValue; // For explain plan, txn won't be opened and doesn't make sense to allocate write id
    }
    queryState.getValidTxnList();
    try {
      return getTxnMgr().getTableWriteId(tableName.getDb(), tableName.getTable());
    } catch (LockException ex) {
      throw new SemanticException("Failed to allocate write Id", ex);
    }
  }
@param totalFiles
         the totalFiles to set
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java