public static TableDesc getTableDesc(String cols, String colTypes) {
    Properties properties = new Properties();
    properties.put(serdeConstants.SERIALIZATION_FORMAT, "" + Utilities.ctrlaCode);
    properties.put(serdeConstants.LIST_COLUMNS, cols);
    properties.put(serdeConstants.LIST_COLUMN_TYPES, colTypes);
    properties.put(serdeConstants.SERIALIZATION_LIB, LazySimpleSerDe.class.getName());
    properties.put(hive_metastoreConstants.TABLE_BUCKETING_VERSION, "-1");
    return (new TableDesc(SequenceFileInputFormat.class,
        HiveSequenceFileOutputFormat.class, properties));
  }
Gets the task id if we are running as a Hadoop job. Gets a random number otherwise.
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java