Skip to content

Commit 2e08de4

Browse files
committed
fix namespaces
1 parent 91b57d5 commit 2e08de4

File tree

10 files changed

+28
-12
lines changed

10 files changed

+28
-12
lines changed

cpp/src/arrow/python/arrow_to_python.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
#include "arrow/python/helpers.h"
2424
#include "arrow/python/numpy_convert.h"
2525

26-
using namespace arrow::py;
27-
2826
namespace arrow {
27+
namespace py {
2928

3029
#if PY_MAJOR_VERSION >= 3
3130
#define PyInt_FromLong PyLong_FromLong
@@ -169,4 +168,5 @@ Status DeserializeArray(std::shared_ptr<Array> array, int32_t offset, PyObject*
169168
return Status::OK();
170169
}
171170

172-
} // namespace arrow
171+
} // namespace py
172+
} // namespace arrow

cpp/src/arrow/python/arrow_to_python.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ extern PyObject* pyarrow_deserialize_callback;
3030
}
3131

3232
namespace arrow {
33+
namespace py {
3334

3435
arrow::Status DeserializeList(std::shared_ptr<arrow::Array> array, int32_t start_idx,
3536
int32_t stop_idx, PyObject* base,
@@ -47,6 +48,7 @@ arrow::Status DeserializeArray(std::shared_ptr<arrow::Array> array, int32_t offs
4748
PyObject* base, const std::vector<std::shared_ptr<arrow::Tensor>>& tensors,
4849
PyObject** out);
4950

50-
} // namespace arrow
51+
} // namespace py
52+
} // namespace arrow
5153

5254
#endif // ARROW_PYTHON_ARROW_TO_PYTHON_H

cpp/src/arrow/python/dict.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <vector>
2121

2222
namespace arrow {
23+
namespace py {
2324

2425
Status DictBuilder::Finish(std::shared_ptr<Array> key_tuple_data,
2526
std::shared_ptr<Array> key_dict_data, std::shared_ptr<Array> val_list_data,
@@ -40,4 +41,5 @@ Status DictBuilder::Finish(std::shared_ptr<Array> key_tuple_data,
4041
return Status::OK();
4142
}
4243

43-
} // namespace arrow
44+
} // namespace py
45+
} // namespace arrow

cpp/src/arrow/python/dict.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "arrow/python/sequence.h"
2424

2525
namespace arrow {
26+
namespace py {
2627

2728
/// Constructing dictionaries of key/value pairs. Sequences of
2829
/// keys and values are built separately using a pair of
@@ -58,6 +59,7 @@ class DictBuilder {
5859
SequenceBuilder vals_;
5960
};
6061

61-
} // namespace arrow
62+
} // namespace py
63+
} // namespace arrow
6264

6365
#endif // PYARROW_DICT_H

cpp/src/arrow/python/python_to_arrow.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ extern "C" {
3030
PyObject* pyarrow_deserialize_callback = NULL;
3131
}
3232

33-
using namespace arrow::py;
34-
3533
namespace arrow {
34+
namespace py {
3635

3736
Status CallCustomSerializationCallback(PyObject* elem, PyObject** serialized_object) {
3837
*serialized_object = NULL;
@@ -281,4 +280,5 @@ std::shared_ptr<RecordBatch> MakeBatch(std::shared_ptr<Array> data) {
281280
return std::shared_ptr<RecordBatch>(new RecordBatch(schema, data->length(), {data}));
282281
}
283282

283+
} // namespace py
284284
} // namespace arrow

cpp/src/arrow/python/python_to_arrow.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ extern PyObject* pyarrow_deserialize_callback;
3434
}
3535

3636
namespace arrow {
37+
namespace py {
3738

3839
arrow::Status SerializeSequences(std::vector<PyObject*> sequences,
3940
int32_t recursion_depth, std::shared_ptr<arrow::Array>* out,
@@ -47,6 +48,7 @@ arrow::Status SerializeArray(PyArrayObject* array, SequenceBuilder& builder,
4748

4849
std::shared_ptr<RecordBatch> MakeBatch(std::shared_ptr<Array> data);
4950

50-
} // namespace arrow
51+
} // namespace py
52+
} // namespace arrow
5153

5254
#endif // ARROW_PYTHON_PYTHON_TO_ARROW_H

cpp/src/arrow/python/scalars.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "arrow/python/sequence.h"
2828

2929
namespace arrow {
30+
namespace py {
3031

3132
Status AppendScalar(PyObject* obj, SequenceBuilder& builder) {
3233
if (PyArray_IsScalar(obj, Bool)) {
@@ -63,6 +64,7 @@ Status AppendScalar(PyObject* obj, SequenceBuilder& builder) {
6364
return builder.AppendInt64(value);
6465
}
6566

67+
} // namespace py
6668
} // namespace arrow
6769

6870
#endif // PYTHON_ARROW_SCALARS_H

cpp/src/arrow/python/sequence.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "arrow/python/sequence.h"
1919

2020
namespace arrow {
21+
namespace py {
2122

2223
SequenceBuilder::SequenceBuilder(MemoryPool* pool)
2324
: pool_(pool),
@@ -162,4 +163,5 @@ Status SequenceBuilder::Finish(std::shared_ptr<Array> list_data,
162163
return Status::OK();
163164
}
164165

165-
} // namespace arrow
166+
} // namespace py
167+
} // namespace arrow

cpp/src/arrow/python/sequence.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "arrow/util/logging.h"
2525

2626
namespace arrow {
27+
namespace py {
2728

2829
class NullArrayBuilder : public arrow::ArrayBuilder {
2930
public:
@@ -136,6 +137,7 @@ class SequenceBuilder {
136137
int8_t num_tags = 0;
137138
};
138139

140+
} // namespace py
139141
} // namespace arrow
140142

141143
#endif // PYTHON_ARROW_SEQUENCE_H

python/pyarrow/serialization.pxi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,21 @@ except ImportError:
3030

3131
from pyarrow.lib cimport Buffer, NativeFile, check_status, _RecordBatchFileWriter
3232

33-
cdef extern from "arrow/python/python_to_arrow.h":
33+
cdef extern from "arrow/python/python_to_arrow.h" namespace 'arrow::py':
3434

3535
cdef CStatus SerializeSequences(c_vector[PyObject*] sequences,
3636
int32_t recursion_depth, shared_ptr[CArray]* array_out,
3737
c_vector[PyObject*]& tensors_out)
3838

3939
cdef shared_ptr[CRecordBatch] MakeBatch(shared_ptr[CArray] data)
4040

41+
cdef extern from "arrow/python/python_to_arrow.h":
42+
4143
cdef extern PyObject *pyarrow_serialize_callback
4244

4345
cdef extern PyObject *pyarrow_deserialize_callback
4446

45-
cdef extern from "arrow/python/arrow_to_python.h":
47+
cdef extern from "arrow/python/arrow_to_python.h" namespace 'arrow::py':
4648

4749
cdef CStatus DeserializeList(shared_ptr[CArray] array, int32_t start_idx,
4850
int32_t stop_idx, PyObject* base,

0 commit comments

Comments
 (0)