Skip to content

Commit

Permalink
apacheGH-45129: [Python][C++] Fix usage of deprecated C++ functionali…
Browse files Browse the repository at this point in the history
…ty on pyarrow
  • Loading branch information
raulcd committed Jan 7, 2025
1 parent e12bc56 commit c1deb19
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
8 changes: 3 additions & 5 deletions python/pyarrow/_parquet.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,9 @@ cdef extern from "parquet/arrow/reader.h" namespace "parquet::arrow" nogil:
const vector[int]& column_indices,
shared_ptr[CTable]* out)

CStatus GetRecordBatchReader(const vector[int]& row_group_indices,
const vector[int]& column_indices,
unique_ptr[CRecordBatchReader]* out)
CStatus GetRecordBatchReader(const vector[int]& row_group_indices,
unique_ptr[CRecordBatchReader]* out)
CResult[unique_ptr[CRecordBatchReader]] GetRecordBatchReader(const vector[int]& row_group_indices,
const vector[int]& column_indices)
CResult[unique_ptr[CRecordBatchReader]] GetRecordBatchReader(const vector[int]& row_group_indices)

CStatus ReadTable(shared_ptr[CTable]* out)
CStatus ReadTable(const vector[int]& column_indices,
Expand Down
8 changes: 4 additions & 4 deletions python/pyarrow/_parquet.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1616,16 +1616,16 @@ cdef class ParquetReader(_Weakrefable):
for index in column_indices:
c_column_indices.push_back(index)
with nogil:
check_status(
recordbatchreader = GetResultValue(
self.reader.get().GetRecordBatchReader(
c_row_groups, c_column_indices, &recordbatchreader
c_row_groups, c_column_indices
)
)
else:
with nogil:
check_status(
recordbatchreader = GetResultValue(
self.reader.get().GetRecordBatchReader(
c_row_groups, &recordbatchreader
c_row_groups
)
)

Expand Down
4 changes: 2 additions & 2 deletions python/pyarrow/src/arrow/python/python_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ Status TestDecimal128OverflowFails() {
ASSERT_EQ(38, metadata.precision());
ASSERT_EQ(1, metadata.scale());

auto type = ::arrow::decimal(38, 38);
auto type = ::arrow::smallest_decimal(38, 38);
const auto& decimal_type = checked_cast<const DecimalType&>(*type);
ASSERT_RAISES(Invalid,
internal::DecimalFromPythonDecimal(python_decimal, decimal_type, &value));
Expand All @@ -689,7 +689,7 @@ Status TestDecimal256OverflowFails() {
ASSERT_EQ(76, metadata.precision());
ASSERT_EQ(1, metadata.scale());

auto type = ::arrow::decimal(76, 76);
auto type = ::arrow::smallest_decimal(76, 76);
const auto& decimal_type = checked_cast<const DecimalType&>(*type);
ASSERT_RAISES(Invalid,
internal::DecimalFromPythonDecimal(python_decimal, decimal_type, &value));
Expand Down

0 comments on commit c1deb19

Please sign in to comment.