protected void copySerdeFromSourceTable(StringBuilder query) {
    if (storageDescriptor != null) {
      ensureTableToCompactIsNative();
      SerDeInfo serdeInfo = storageDescriptor.getSerdeInfo();
      Map<String, String> serdeParams = serdeInfo.getParameters();
      query.append(" ROW FORMAT SERDE '").append(HiveStringUtils.escapeHiveCommand(serdeInfo.getSerializationLib()))
          .append("'");
      // WITH SERDEPROPERTIES
      if (!serdeParams.isEmpty()) {
        DDLPlanUtils.appendSerdeParams(query, serdeParams);
      }
      query.append("STORED AS INPUTFORMAT '")
          .append(HiveStringUtils.escapeHiveCommand(storageDescriptor.getInputFormat())).append("'")
          .append(" OUTPUTFORMAT '").append(HiveStringUtils.escapeHiveCommand(storageDescriptor.getOutputFormat()))
          .append("'");
    }

  }
Part of Create operation. Insert-only compaction tables copy source tables' serde.
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactionQueryBuilderForInsertOnly.java