Skip to content

Commit dc161f8

Browse files
Improve error message when data structure overflow is detected (#536).
1 parent f1551b8 commit dc161f8

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ Common Changes
5858
frames supporting the Arrow PyCapsule interface as requested
5959
(`issue 535 <https://github.com/oracle/python-oracledb/issues/535>`__).
6060
- Data frames with multiple chunks are now supported.
61+
- Error ``DPY-8002: Apach Arrow C Data structure overflow detected. A
62+
larger structure is needed.`` is now raised when an overflow is detected
63+
(`issue 536 <https://github.com/oracle/python-oracledb/issues/536>`__).
6164
- Fixed bug when fetching NCHAR and NVARCHAR2 column data.
6265
- Fixed bug when attempting to convert an integer that cannot be
6366
represented as a native C ``int`` value to an Arrow data frame.

src/oracledb/arrow_impl.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
cimport cpython
3434

35-
from libc.errno cimport EINVAL
35+
from libc.errno cimport EINVAL, EOVERFLOW
3636
from libc.stdint cimport uintptr_t
3737
from libc.string cimport memcpy, memset, strlen, strchr
3838
from cpython cimport array

src/oracledb/errors.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ def _raise_not_supported(feature: str) -> None:
404404
# error numbers that result in DataError
405405
ERR_VALUE_TOO_LARGE = 8000
406406
ERR_NULLS_NOT_ALLOWED = 8001
407+
ERR_ARROW_DATA_STRUCTURE_OVERFLOW = 8002
407408

408409
# Oracle error number cross reference
409410
ERR_ORACLE_ERROR_XREF = {
@@ -570,6 +571,10 @@ def _raise_not_supported(feature: str) -> None:
570571
ERR_ARROW_C_API_ERROR: (
571572
"Apache Arrow C Data Interface operation failed with error code {code}"
572573
),
574+
ERR_ARROW_DATA_STRUCTURE_OVERFLOW: (
575+
"Apache Arrow C Data structure overflow detected. A larger structure "
576+
"is needed."
577+
),
573578
ERR_ARROW_SPARSE_VECTOR_NOT_ALLOWED: (
574579
"Apache Arrow format does not support sparse vectors with flexible "
575580
"dimensions"

src/oracledb/impl/arrow/utils.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ cdef int _check_nanoarrow(int code) except -1:
159159
it is not NANOARROW_OK.
160160
"""
161161
if code != NANOARROW_OK:
162+
if code == EOVERFLOW:
163+
errors._raise_err(errors.ERR_ARROW_DATA_STRUCTURE_OVERFLOW)
162164
errors._raise_err(errors.ERR_ARROW_C_API_ERROR, code=code)
163165

164166

0 commit comments

Comments
 (0)