Reader interface for a single ORC file Parameters ---------- source : str or pyarrow.NativeFile Readable source. For passing Python file objects or byte buffers, see pyarrow.io.PythonFileInterface or pyarrow.io.BufferReader.
| 25 | |
| 26 | |
| 27 | class ORCFile: |
| 28 | """ |
| 29 | Reader interface for a single ORC file |
| 30 | |
| 31 | Parameters |
| 32 | ---------- |
| 33 | source : str or pyarrow.NativeFile |
| 34 | Readable source. For passing Python file objects or byte buffers, |
| 35 | see pyarrow.io.PythonFileInterface or pyarrow.io.BufferReader. |
| 36 | """ |
| 37 | |
| 38 | def __init__(self, source): |
| 39 | self.reader = _orc.ORCReader() |
| 40 | self.reader.open(source) |
| 41 | |
| 42 | @property |
| 43 | def metadata(self): |
| 44 | """The file metadata, as an arrow KeyValueMetadata""" |
| 45 | return self.reader.metadata() |
| 46 | |
| 47 | @property |
| 48 | def schema(self): |
| 49 | """The file schema, as an arrow schema""" |
| 50 | return self.reader.schema() |
| 51 | |
| 52 | @property |
| 53 | def nrows(self): |
| 54 | """The number of rows in the file""" |
| 55 | return self.reader.nrows() |
| 56 | |
| 57 | @property |
| 58 | def nstripes(self): |
| 59 | """The number of stripes in the file""" |
| 60 | return self.reader.nstripes() |
| 61 | |
| 62 | @property |
| 63 | def file_version(self): |
| 64 | """Format version of the ORC file, must be 0.11 or 0.12""" |
| 65 | return self.reader.file_version() |
| 66 | |
| 67 | @property |
| 68 | def software_version(self): |
| 69 | """Software instance and version that wrote this file""" |
| 70 | return self.reader.software_version() |
| 71 | |
| 72 | @property |
| 73 | def compression(self): |
| 74 | """Compression codec of the file""" |
| 75 | return self.reader.compression() |
| 76 | |
| 77 | @property |
| 78 | def compression_size(self): |
| 79 | """Number of bytes to buffer for the compression codec in the file""" |
| 80 | return self.reader.compression_size() |
| 81 | |
| 82 | @property |
| 83 | def writer(self): |
| 84 | """Name of the writer that wrote this file. |