from typing import IO, Literal

from .lib import (
    Buffer,
    KeyValueMetadata,
    MemoryPool,
    NativeFile,
    RecordBatch,
    Schema,
    Table,
    _Weakrefable,
)

class ORCReader(_Weakrefable):
    def __init__(self, memory_pool: MemoryPool | None = None) -> None: ...
    def open(self, source: str | NativeFile | Buffer, use_memory_map: bool = True): ...
    def metadata(self) -> KeyValueMetadata: ...
    def schema(self) -> Schema: ...
    def nrows(self) -> int: ...
    def nstripes(self) -> int: ...
    def file_version(self) -> str: ...
    def software_version(self) -> str: ...
    def compression(self) -> Literal["UNCOMPRESSED", "ZLIB", "SNAPPY", "LZ4", "ZSTD"]: ...
    def compression_size(self) -> int: ...
    def row_index_stride(self) -> int: ...
    def writer(self) -> str: ...
    def writer_version(self) -> str: ...
    def nstripe_statistics(self) -> int: ...
    def content_length(self) -> int: ...
    def stripe_statistics_length(self) -> int: ...
    def file_footer_length(self) -> int: ...
    def file_postscript_length(self) -> int: ...
    def file_length(self) -> int: ...
    def serialized_file_tail(self) -> int: ...
    def read_stripe(self, n: int, columns: list[str] | None = None) -> RecordBatch: ...
    def read(self, columns: list[str] | None = None) -> Table: ...

class ORCWriter(_Weakrefable):
    def open(
        self,
        where: str | NativeFile | IO,
        *,
        file_version: str | None = None,
        batch_size: int | None = None,
        stripe_size: int | None = None,
        compression: Literal["UNCOMPRESSED", "ZLIB", "SNAPPY", "LZ4", "ZSTD"] | None = None,
        compression_block_size: int | None = None,
        compression_strategy: Literal["COMPRESSION", "SPEED"] | None = None,
        row_index_stride: int | None = None,
        padding_tolerance: float | None = None,
        dictionary_key_size_threshold: float | None = None,
        bloom_filter_columns: list[int] | None = None,
        bloom_filter_fpp: float | None = None,
    ) -> None: ...
    def write(self, table: Table) -> None: ...
    def close(self) -> None: ...
