Skip to content

Commit e1fc085

Browse files
Simplify code by making use of new function available in nanoarrow
0.7.0.
1 parent 0e779c3 commit e1fc085

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

src/oracledb/impl/arrow/array.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ cdef class ArrowArrayImpl:
382382
ArrowDecimalSetBytes(&decimal, ptr + index * 16)
383383
ArrowBufferInit(&buf)
384384
try:
385-
_check_nanoarrow(ArrowDecimalAppendDigitsToBuffer(
385+
_check_nanoarrow(ArrowDecimalAppendStringToBuffer(
386386
&decimal, &buf
387387
))
388388
return buf.data[:buf.size_bytes]

src/oracledb/impl/arrow/utils.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ cdef extern from "nanoarrow.c":
118118
void *private_data)
119119
void ArrowBufferInit(ArrowBuffer* buffer)
120120
void ArrowBufferReset(ArrowBuffer* buffer)
121-
ArrowErrorCode ArrowDecimalAppendDigitsToBuffer(const ArrowDecimal* decimal,
121+
ArrowErrorCode ArrowDecimalAppendStringToBuffer(const ArrowDecimal* decimal,
122122
ArrowBuffer* buffer)
123123
void ArrowDecimalInit(ArrowDecimal* decimal, int32_t bitwidth,
124124
int32_t precision, int32_t scale)

src/oracledb/impl/base/converters.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ cdef object convert_arrow_to_oracle_data(OracleMetadata metadata,
8383
elif arrow_type == NANOARROW_TYPE_DECIMAL128:
8484
temp_bytes = arrow_array.get_decimal(array_index, &data.is_null)
8585
if not data.is_null:
86-
temp_bytes = temp_bytes[:-arrow_array.scale] + b"." + \
87-
temp_bytes[-arrow_array.scale:]
8886
convert_bytes_to_oracle_data(&data.buffer, temp_bytes)
8987
return temp_bytes
9088
elif arrow_type in (NANOARROW_TYPE_LIST, NANOARROW_TYPE_FIXED_SIZE_LIST):

0 commit comments

Comments
 (0)