code: public static String generateStagingCTASStatementFromSelectStar(HiveDatasetFinder.DbAndTable outputDbAndTable,
        HiveDatasetFinder.DbAndTable sourceEntity, Map<String, String> partitionDMLInfo,
        StorageFormat storageFormat, String outputTableLocation) {
      StringBuilder sourceQueryBuilder = new StringBuilder("SELECT * FROM `").append(sourceEntity.getDb())
          .append("`.`").append(sourceEntity.getTable()).append("`");
      if (partitionDMLInfo != null && !partitionDMLInfo.isEmpty()) {
        sourceQueryBuilder.append(" WHERE ");
        sourceQueryBuilder.append(partitionDMLInfo.entrySet().stream()
            .map(e -> "`" + e.getKey() + "`='" + e.getValue() + "'")
            .collect(joining(" AND ")));
      }
      return generateStagingCTASStatement(outputDbAndTable, sourceQueryBuilder.toString(), storageFormat, outputTableLocation);
    }
docs: Generates a CTAS statement to dump the contents of a table / partition into a new table.
  @param outputDbAndTable output db and table where contents should be written.
  @param sourceEntity source table / partition.
  @param partitionDMLInfo map of partition values.
  @param storageFormat format of output table.
  @param outputTableLocation location where files of output table should be written.