Search in sources :

Example 1 with WriteStatement

use of org.apache.asterix.lang.common.statement.WriteStatement in project asterixdb by apache.

the class QueryTranslator method handleWriteStatement.

protected Pair<IAWriterFactory, FileSplit> handleWriteStatement(Statement stmt) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
    WriteStatement ws = (WriteStatement) stmt;
    File f = new File(ws.getFileName());
    FileSplit outputFile = new UnmanagedFileSplit(ws.getNcName().getValue(), f.getPath());
    IAWriterFactory writerFactory = null;
    if (ws.getWriterClassName() != null) {
        writerFactory = (IAWriterFactory) Class.forName(ws.getWriterClassName()).newInstance();
    }
    return new Pair<>(writerFactory, outputFile);
}
Also used : WriteStatement(org.apache.asterix.lang.common.statement.WriteStatement) FileSplit(org.apache.hyracks.api.io.FileSplit) UnmanagedFileSplit(org.apache.hyracks.api.io.UnmanagedFileSplit) UnmanagedFileSplit(org.apache.hyracks.api.io.UnmanagedFileSplit) ExternalFile(org.apache.asterix.external.indexing.ExternalFile) File(java.io.File) IAWriterFactory(org.apache.hyracks.algebricks.data.IAWriterFactory) Pair(org.apache.hyracks.algebricks.common.utils.Pair)

Aggregations

File (java.io.File)1 ExternalFile (org.apache.asterix.external.indexing.ExternalFile)1 WriteStatement (org.apache.asterix.lang.common.statement.WriteStatement)1 Pair (org.apache.hyracks.algebricks.common.utils.Pair)1 IAWriterFactory (org.apache.hyracks.algebricks.data.IAWriterFactory)1 FileSplit (org.apache.hyracks.api.io.FileSplit)1 UnmanagedFileSplit (org.apache.hyracks.api.io.UnmanagedFileSplit)1