Skip to content

Commit

Permalink
Fix overflow bug in low-memory JSON reader (#16632)
Browse files Browse the repository at this point in the history
Bug fix for #16627.
Changes byte range offsets and sizes from `size_type` to `size_t` in pylibcudf.

Authors:
  - Shruti Shivakumar (https://github.com/shrshi)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - GALI PREM SAGAR (https://github.com/galipremsagar)

URL: #16632
  • Loading branch information
shrshi authored Aug 22, 2024
1 parent 6c4905d commit 1fd9675
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions python/pylibcudf/pylibcudf/io/json.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ cpdef TableWithMetadata read_json(
list dtypes = *,
compression_type compression = *,
bool lines = *,
size_type byte_range_offset = *,
size_type byte_range_size = *,
size_t byte_range_offset = *,
size_t byte_range_size = *,
bool keep_quotes = *,
bool mixed_types_as_string = *,
bool prune_columns = *,
Expand Down
12 changes: 6 additions & 6 deletions python/pylibcudf/pylibcudf/io/json.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ cdef json_reader_options _setup_json_reader_options(
list dtypes,
compression_type compression,
bool lines,
size_type byte_range_offset,
size_type byte_range_size,
size_t byte_range_offset,
size_t byte_range_size,
bool keep_quotes,
bool mixed_types_as_string,
bool prune_columns,
Expand Down Expand Up @@ -189,8 +189,8 @@ cpdef TableWithMetadata read_json(
list dtypes = None,
compression_type compression = compression_type.AUTO,
bool lines = False,
size_type byte_range_offset = 0,
size_type byte_range_size = 0,
size_t byte_range_offset = 0,
size_t byte_range_size = 0,
bool keep_quotes = False,
bool mixed_types_as_string = False,
bool prune_columns = False,
Expand All @@ -212,9 +212,9 @@ cpdef TableWithMetadata read_json(
(column_child_name, column_child_type, list of grandchild dtypes).
compression: CompressionType, default CompressionType.AUTO
The compression format of the JSON source.
byte_range_offset : size_type, default 0
byte_range_offset : size_t, default 0
Number of bytes to skip from source start.
byte_range_size : size_type, default 0
byte_range_size : size_t, default 0
Number of bytes to read. By default, will read all bytes.
keep_quotes : bool, default False
Whether the reader should keep quotes of string values.
Expand Down
12 changes: 6 additions & 6 deletions python/pylibcudf/pylibcudf/libcudf/io/json.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ cdef extern from "cudf/io/json.hpp" \
cudf_io_types.source_info get_source() except +
vector[string] get_dtypes() except +
cudf_io_types.compression_type get_compression() except +
size_type get_byte_range_offset() except +
size_type get_byte_range_size() except +
size_t get_byte_range_offset() except +
size_t get_byte_range_size() except +
bool is_enabled_lines() except +
bool is_enabled_mixed_types_as_string() except +
bool is_enabled_prune_columns() except +
Expand All @@ -41,8 +41,8 @@ cdef extern from "cudf/io/json.hpp" \
void set_compression(
cudf_io_types.compression_type compression
) except +
void set_byte_range_offset(size_type offset) except +
void set_byte_range_size(size_type size) except +
void set_byte_range_offset(size_t offset) except +
void set_byte_range_size(size_t size) except +
void enable_lines(bool val) except +
void enable_mixed_types_as_string(bool val) except +
void enable_prune_columns(bool val) except +
Expand Down Expand Up @@ -73,10 +73,10 @@ cdef extern from "cudf/io/json.hpp" \
cudf_io_types.compression_type compression
) except +
json_reader_options_builder& byte_range_offset(
size_type offset
size_t offset
) except +
json_reader_options_builder& byte_range_size(
size_type size
size_t size
) except +
json_reader_options_builder& lines(
bool val
Expand Down

0 comments on commit 1fd9675

Please sign in to comment.