@Override
  protected void setSqlKind(SqlKind sqlKind) {
    // NO-OP: prevent Semantic Analyzer to turn this query to a simple SqlKind=INSERT
    // we classify acid export as HiveOperation.EXPORT
  }
Makes the exportTask run after all other tasks of the "insert into T ..." are done.
ql/src/java/org/apache/hadoop/hive/ql/parse/AcidExportSemanticAnalyzer.java