K i:1 ddlmZddlZddlmZddlmZddlmZGddZ dZ Gdd Z dd Z d e _ d d dddddddddd dZde de_ y))IntegralN)Table)_resolve_filesystem_and_pathc>eZdZdZdZedZedZedZedZ edZ edZ ed Z ed Z ed Zed Zed ZedZedZedZedZedZedZddZddZddZy)ORCFilea 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. cltj|_|jj|yN)_orc ORCReaderreaderopen)selfsources Q/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pyarrow/orc.py__init__zORCFile.__init__&s"nn&   c6|jjS)z/The file metadata, as an arrow KeyValueMetadata)r metadatars rrzORCFile.metadata*{{##%%rc6|jjS)z#The file schema, as an arrow schema)r schemars rrzORCFile.schema/s{{!!##rc6|jjS)zThe number of rows in the file)r nrowsrs rrz ORCFile.nrows4s{{  ""rc6|jjS)z!The number of stripes in the file)r nstripesrs rrzORCFile.nstripes9rrc6|jjS)z4Format version of the ORC file, must be 0.11 or 0.12)r file_versionrs rrzORCFile.file_version>s{{''))rc6|jjS)z2Software instance and version that wrote this file)r software_versionrs rr zORCFile.software_versionC{{++--rc6|jjS)zCompression codec of the file)r compressionrs rr#zORCFile.compressionH{{&&((rc6|jjS)z?Number of bytes to buffer for the compression codec in the file)r compression_sizers rr&zORCFile.compression_sizeMr!rc6|jjS)z{Name of the writer that wrote this file. If the writer is unknown then its Writer ID (a number) is returned)r writerrs rr(zORCFile.writerRs {{!!##rc6|jjS)zVersion of the writer)r writer_versionrs rr*zORCFile.writer_versionY{{))++rc6|jjS)zRNumber of rows per an entry in the row index or 0 if there is no row index)r row_index_striders rr-zORCFile.row_index_stride^s{{++--rc6|jjS)zNumber of stripe statistics)r nstripe_statisticsrs rr/zORCFile.nstripe_statisticsd{{--//rc6|jjS)z/Length of the data stripes in the file in bytes)r content_lengthrs rr2zORCFile.content_lengthir+rc6|jjS)z`_ is the older version while `Hive 0.12 / ORC v1 `_ is the newer one. batch_size : int, default 1024 Number of rows the ORC writer writes at a time. stripe_size : int, default 64 * 1024 * 1024 Size of each ORC stripe in bytes. compression : string, default 'uncompressed' The compression codec. Valid values: {'UNCOMPRESSED', 'SNAPPY', 'ZLIB', 'LZ4', 'ZSTD'} Note that LZ0 is currently not supported. compression_block_size : int, default 64 * 1024 Size of each compression block in bytes. compression_strategy : string, default 'speed' The compression strategy i.e. speed vs size reduction. Valid values: {'SPEED', 'COMPRESSION'} row_index_stride : int, default 10000 The row index stride i.e. the number of rows per an entry in the row index. padding_tolerance : double, default 0.0 The padding tolerance. dictionary_key_size_threshold : double, default 0.0 The dictionary key size threshold. 0 to disable dictionary encoding. 1 to always enable dictionary encoding. bloom_filter_columns : None, set-like or list-like, default None Columns that use the bloom filter. bloom_filter_fpp : double, default 0.05 Upper limit of the false-positive rate of the bloom filter. c ZeZdZdedZdZdddddd d d d d d d dZdZdZdZ dZ dZ y ) ORCWritera Writer interface for a single ORC file Parameters ---------- where : str or pyarrow.io.NativeFile Writable target. For passing Python file objects or byte buffers, see pyarrow.io.PythonFileInterface, pyarrow.io.BufferOutputStream or pyarrow.io.FixedSizeBufferWriter.  F0.12 uncompressedspeed'N皙? r batch_size stripe_sizer#compression_block_sizecompression_strategyr-padding_tolerancedictionary_key_size_thresholdbloom_filter_columnsbloom_filter_fppc tj|_|jj||||||||| | | |  d|_y)Nr^T)r rSr(r is_open) rwhererr_r`r#rarbr-rcrdrerfs rrzORCWriter.__init__sVnn&   %!###9!5-/*G!5-   rc$|jyr closers r__del__zORCWriter.__del__   rc|Sr rQrs r __enter__zORCWriter.__enter__s rc$|jyr rk)rargskwargss r__exit__zORCWriter.__exit__rnrcV|jsJ|jj|y)a  Write the table into an ORC file. The schema of the table must be equal to the schema used when opening the ORC file. Parameters ---------- table : pyarrow.Table The table to be written into the ORC file N)rhr(write)rtables rrvzORCWriter.writes"||| % rc`|jr"|jjd|_yy)z$ Close the ORC file FN)rhr(rlrs rrlzORCWriter.close#s' << KK    DL r) rLrMrN_orc_writer_args_docsrOrhrrmrprtrvrlrQrrrSrSsc  GG% -+(-&-"'#&/2&*"&< !!rrSct||\}}||j|}|8t|dk(r*t|j j |}|St|j |}|S)NrrG)ropen_input_filer>rrKselect)rrB filesystempathresults r read_tabler,s|3FJGJ++D1s7|q0%%'..w7 M%%g%6 Mra Read a Table from an ORC file. Parameters ---------- source : str, pyarrow.NativeFile, or file-like object If a string passed, can be a single file name. For file-like objects, only read a single file. Use pyarrow.BufferReader to read a file contained in a bytes or buffer-like object. columns : list If not None, only these columns will be read from the file. A column name may be a prefix of a nested field, e.g. 'a' will select 'a.b', 'a.c', and 'a.d.e'. Output always follows the ordering of the file and not the `columns` list. If empty, no columns will be read. Note that the table will still have the correct num_rows set despite having no columns. filesystem : FileSystem, default None If nothing passed, will be inferred based on path. Path will try to be found in the local on-disk filesystem otherwise it will be parsed as an URI to determine the filesystem. rUrVrWrXrYrZr[r\r]r^c t|tr tjdtd||}}t ||||||||| | | |  5} | j |dddy#1swYyxYw)NzThe order of the arguments has changed. Pass as 'write_table(table, where)' instead. The old order will raise an error in the future.) stacklevelr^)r<rwarningswarn FutureWarningrSrv)rwrirr_r`r#rarbr-rcrdrerfr(s r write_tablerPs%  &'4 eu  !51)+&C1)   Us A##A,aZ Write a table into an ORC file. Parameters ---------- table : pyarrow.lib.Table The table to be written into the ORC file where : str or pyarrow.io.NativeFile Writable target. For passing Python file objects or byte buffers, see pyarrow.io.PythonFileInterface, pyarrow.io.BufferOutputStream or pyarrow.io.FixedSizeBufferWriter. rT)NN)numbersrr pyarrow.libr pyarrow._orcr pyarrow.fsrrryrSrrOrrQrrrs&3`1`1FDI!I!X  0$,*',%,!&"%.1%)!%!H   r