Skip to content

Commit 40bb0c7

Browse files
committed
use gandiva files
1 parent 829f7a2 commit 40bb0c7

File tree

2 files changed

+7
-29
lines changed

2 files changed

+7
-29
lines changed

python/pyarrow/gandiva.pyx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ from libc.stdint cimport int64_t, uint8_t, uintptr_t
2727

2828
from pyarrow.includes.libarrow cimport *
2929
from pyarrow.compat import frombytes
30-
from pyarrow.lib cimport pyarrow_wrap_array
30+
from pyarrow.lib cimport (check_status, pyarrow_wrap_array)
3131

32-
from pyarrow.includes.libgandiva cimport (GStatus, CExpression,
33-
CCondition,
32+
from pyarrow.includes.libgandiva cimport (CCondition, CExpression,
3433
CNode, CProjector, CFilter,
3534
CSelectionVector,
3635
TreeExprBuilder_MakeExpression,
@@ -46,14 +45,6 @@ from pyarrow.includes.libgandiva cimport (GStatus, CExpression,
4645
from pyarrow.lib cimport (Array, DataType, Field, MemoryPool,
4746
RecordBatch, Schema)
4847

49-
cdef int check_status(const GStatus& status) nogil except -1:
50-
if status.ok():
51-
return 0
52-
53-
with gil:
54-
message = frombytes(status.message())
55-
raise Exception(message)
56-
5748
cdef class Node:
5849
cdef:
5950
shared_ptr[CNode] node

python/pyarrow/includes/libgandiva.pxd

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,6 @@
2020
from pyarrow.includes.common cimport *
2121
from pyarrow.includes.libarrow cimport *
2222

23-
cdef extern from "arrow/status.h" namespace "gandiva" nogil:
24-
# We can later add more of the common status factory methods as needed
25-
cdef GStatus GStatus_OK "Status::OK"()
26-
cdef GStatus GStatus_Invalid "Status::Invalid"()
27-
28-
cdef cppclass GStatus "arrow::Status":
29-
GStatus()
30-
31-
c_string ToString()
32-
c_string message()
33-
34-
c_bool ok()
35-
3623
cdef extern from "gandiva/gandiva_aliases.h" namespace "gandiva" nogil:
3724

3825
cdef cppclass CNode" gandiva::Node":
@@ -52,7 +39,7 @@ cdef extern from "gandiva/selection_vector.h" namespace "gandiva" nogil:
5239

5340
shared_ptr[CArray] ToArray()
5441

55-
cdef GStatus SelectionVector_MakeInt32\
42+
cdef CStatus SelectionVector_MakeInt32\
5643
"gandiva::SelectionVector::MakeInt32"(
5744
int max_slots, CMemoryPool* pool,
5845
shared_ptr[CSelectionVector]* selection_vector)
@@ -93,7 +80,7 @@ cdef extern from "gandiva/tree_expr_builder.h" namespace "gandiva" nogil:
9380
"gandiva::TreeExprBuilder::MakeCondition"(
9481
shared_ptr[CNode] condition)
9582

96-
cdef GStatus Projector_Make \
83+
cdef CStatus Projector_Make \
9784
"gandiva::Projector::Make"(
9885
shared_ptr[CSchema] schema, const CExpressionVector& children,
9986
shared_ptr[CProjector]* projector)
@@ -102,19 +89,19 @@ cdef extern from "gandiva/projector.h" namespace "gandiva" nogil:
10289

10390
cdef cppclass CProjector" gandiva::Projector":
10491

105-
GStatus Evaluate(
92+
CStatus Evaluate(
10693
const CRecordBatch& batch, CMemoryPool* pool,
10794
const CArrayVector* output)
10895

10996
cdef extern from "gandiva/filter.h" namespace "gandiva" nogil:
11097

11198
cdef cppclass CFilter" gandiva::Filter":
11299

113-
GStatus Evaluate(
100+
CStatus Evaluate(
114101
const CRecordBatch& batch,
115102
shared_ptr[CSelectionVector] out_selection)
116103

117-
cdef GStatus Filter_Make \
104+
cdef CStatus Filter_Make \
118105
"gandiva::Filter::Make"(
119106
shared_ptr[CSchema] schema, shared_ptr[CCondition] condition,
120107
shared_ptr[CFilter]* filter)

0 commit comments

Comments
 (0)