Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Parquet Reader options classes to pylibcudf #17464

Draft
wants to merge 2 commits into
base: branch-25.02
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cpp/include/cudf/io/parquet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ class parquet_reader_options_builder {
*
* @param val Boolean value whether to read matching projected and filter columns from mismatched
* Parquet sources.
*
* @return this for chaining.
*/
parquet_reader_options_builder& allow_mismatched_pq_schemas(bool val)
Expand Down
17 changes: 17 additions & 0 deletions python/pylibcudf/pylibcudf/io/parquet.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ from pylibcudf.table cimport Table
from pylibcudf.types cimport DataType


cdef class ParquetReaderOptions:
cdef parquet_reader_options
cdef SourceInfo source
cpdef void set_row_groups(self, list row_groups)
cpdef void set_num_rows(self, size_type nrows)
cpdef void set_skip_rows(self, int64_t skip_rows)
cpdef void set_columns(self, list col_names)
cpdef void set_filter(self, Expression filter)

cdef class ParquetReaderOptionsBuilder:
cpdef ParquetReaderOptionsBuilder convert_strings_to_categories(self, bool val)
cpdef ParquetReaderOptionsBuilder use_pandas_metadata(self, bool val)
cpdef ParquetReaderOptionsBuilder allow_mismatched_pq_schemas(self, bool val)
cpdef ParquetReaderOptionsBuilder use_arrow_schema(self, bool val)
cpdef build(self)


cdef class ChunkedParquetReader:
cdef unique_ptr[cpp_chunked_parquet_reader] reader

Expand Down
21 changes: 20 additions & 1 deletion python/pylibcudf/pylibcudf/io/parquet.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright (c) 2024, NVIDIA CORPORATION.

from collections.abc import Mapping
from typing import Self

from typing_extensions import Self

from pylibcudf.expressions import Expression
from pylibcudf.io.types import (
Expand All @@ -16,6 +17,24 @@ from pylibcudf.io.types import (
)
from pylibcudf.table import Table

class ParquetReaderOptions:
def __init__(self): ...
def set_row_groups(self, row_groups: list[list[int]]): ...
def set_num_rows(self, nrows: int): ...
def set_skip_rows(self, skip_rows: int): ...
def set_columns(self, col_names: list[str]): ...
def set_filter(self, filter: Expression): ...
@staticmethod
def builder(source: SourceInfo) -> ParquetReaderOptionsBuilder: ...

class ParquetReaderOptionsBuilder:
def __init__(self): ...
def convert_strings_to_categories(self, val: bool) -> Self: ...
def use_pandas_metadata(self, val: bool) -> Self: ...
def allow_mismatched_pq_schemas(self, val: bool) -> Self: ...
def use_arrow_schema(self, val: bool) -> Self: ...
def build(self) -> ParquetReaderOptions: ...

class ChunkedParquetReader:
def __init__(
self,
Expand Down