Search in sources :

Example 1 with JsonWriter

use of org.apache.drill.exec.physical.resultSet.util.JsonWriter in project drill by apache.

the class StreamingHttpConnection method outputAvailable.

/**
 * Set the output stream. Sent from the REST request thread in the
 * {@code StreamingOutput} callback once the output stream is
 * available. Unblocks the Screen thread.
 */
public void outputAvailable(OutputStream out) throws IOException {
    this.out = out;
    writer = new JsonWriter(out, false, false);
    startSignal.countDown();
}
Also used : JsonWriter(org.apache.drill.exec.physical.resultSet.util.JsonWriter)

Example 2 with JsonWriter

use of org.apache.drill.exec.physical.resultSet.util.JsonWriter in project drill by apache.

the class JsonFileBuilder method build.

/**
 * Writes the configured data to the given file in json format.
 * @param tableFile The file to write the json data to.
 * @throws IOException
 */
public void build(File tableFile) throws IOException {
    tableFile.getParentFile().mkdirs();
    try (BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(tableFile))) {
        JsonWriter jsonWriter = new JsonWriter(os, pretty, useExtendedOutput);
        final RowSetReader reader = rowSet.reader();
        while (reader.next()) {
            jsonWriter.writeRow(reader);
        }
    }
}
Also used : FileOutputStream(java.io.FileOutputStream) RowSetReader(org.apache.drill.exec.physical.rowSet.RowSetReader) BufferedOutputStream(java.io.BufferedOutputStream) JsonWriter(org.apache.drill.exec.physical.resultSet.util.JsonWriter)

Aggregations

JsonWriter (org.apache.drill.exec.physical.resultSet.util.JsonWriter)2 BufferedOutputStream (java.io.BufferedOutputStream)1 FileOutputStream (java.io.FileOutputStream)1 RowSetReader (org.apache.drill.exec.physical.rowSet.RowSetReader)1