Class HadoopOutputFile
Object
io.delta.kernel.defaults.engine.hadoopio.HadoopOutputFile
- All Implemented Interfaces:
OutputFile
-
Constructor Summary
ConstructorsConstructorDescriptionHadoopOutputFile(org.apache.hadoop.conf.Configuration hadoopConf, String path) -
Method Summary
Modifier and TypeMethodDescriptioncreate(boolean putIfAbsent) Get the output stream to write to the file.path()Get the path of the file.voidwriteAtomically(io.delta.kernel.utils.CloseableIterator<String> data, boolean overwrite) Atomically write (either write is completely or don't write all - i.e.
-
Constructor Details
-
HadoopOutputFile
-
-
Method Details
-
path
Description copied from interface:OutputFileGet the path of the file.- Specified by:
pathin interfaceOutputFile- Returns:
- the path of the file.
-
create
Description copied from interface:OutputFileGet the output stream to write to the file.- If the file already exists, (either at the time of creating the
PositionOutputStreamor at the time of closing it), it will be overwritten. - if
atomicWriteis set, then the entire content is written or none, but won't create a file with the partial contents.
- Specified by:
createin interfaceOutputFile- Returns:
- the output stream to write to the file. It is the responsibility of the caller to close the stream.
- Throws:
IOException- if an I/O error occurs.
- If the file already exists, (either at the time of creating the
-
writeAtomically
public void writeAtomically(io.delta.kernel.utils.CloseableIterator<String> data, boolean overwrite) throws IOException Description copied from interface:OutputFileAtomically write (either write is completely or don't write all - i.e. don't leave file with partial content) the data to a file at the given path. If the file already exists do not replace it ifreplaceis false. Ifreplaceis true, then replace the file with the new data.TODO: the semantics are very loose here, see if there is a better API name. One of the reasons why the data is passed as an iterator is because of the existing LogStore interface which are used in the Hadoop implementation of the
FileIO- Specified by:
writeAtomicallyin interfaceOutputFile- Parameters:
data- the data to write. Each element in the iterator is a line in the file.overwrite- if true, overwrite the file with the new data. If false, do not overwrite the file.- Throws:
IOException- for any IO error.
-