Search in sources :

Example 1 with TimePartitionOutput

use of co.cask.cdap.api.dataset.lib.TimePartitionOutput in project cdap by caskdata.

the class PartitionCorrectorTestRun method createPartition.

private void createPartition(DataSetManager<TimePartitionedFileSet> tpfsManager, long time, int i) throws Exception {
    TimePartitionedFileSet tpfs = tpfsManager.get();
    TimePartitionOutput output = tpfs.getPartitionOutput(time);
    try (PrintStream out = new PrintStream(output.getLocation().append("file").getOutputStream())) {
        out.println(String.format("%d,x%d", i, i));
    }
    output.addPartition();
    tpfsManager.flush();
}
Also used : PrintStream(java.io.PrintStream) TimePartitionOutput(co.cask.cdap.api.dataset.lib.TimePartitionOutput) TimePartitionedFileSet(co.cask.cdap.api.dataset.lib.TimePartitionedFileSet)

Aggregations

TimePartitionOutput (co.cask.cdap.api.dataset.lib.TimePartitionOutput)1 TimePartitionedFileSet (co.cask.cdap.api.dataset.lib.TimePartitionedFileSet)1 PrintStream (java.io.PrintStream)1