public void pruneColumns(Configuration conf, Path inputFile, Path outputFile, List<String> cols)
      throws IOException {
    RewriteOptions options = new RewriteOptions.Builder(conf, inputFile, outputFile)
        .prune(cols)
        .build();
    ParquetRewriter rewriter = new ParquetRewriter(options);
    rewriter.processBlocks();
    rewriter.close();
  }
@Test
  public void testPruneNestedParentColumn() throws Exception {
    // Create Parquet file
    String inputFile = createParquetFile("input");
    String outputFile = createTempFile("output");

    // Remove parent column. All of it's children will be removed.
    List<String> cols = Arrays.asList("Links");
    columnPruner.pruneColumns(conf, new Path(inputFile), new Path(outputFile), cols);

    // Verify the schema are not changed for the columns not pruned
    ParquetMetadata pmd =
        ParquetFileReader.readFooter(conf, new Path(outputFile), ParquetMetadataConverter.NO_FILTER);
    MessageType schema = pmd.getFileMetaData().getSchema();
    List<Type> fields = schema.getFields();
    assertEquals(fields.size(), 3);
    assertEquals(fields.get(0).getName(), "DocId");
    assertEquals(fields.get(1).getName(), "Name");
    assertEquals(fields.get(2).getName(), "Gender");

    // Verify the data are not changed for the columns not pruned
    List<String> prunePaths = Arrays.asList("Links");
    validateColumns(inputFile, prunePaths);
  }