Skip to content

Commit

Permalink
fix namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
pcmoritz committed Aug 16, 2017
1 parent 91b57d5 commit 2e08de4
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 12 deletions.
6 changes: 3 additions & 3 deletions cpp/src/arrow/python/arrow_to_python.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
#include "arrow/python/helpers.h"
#include "arrow/python/numpy_convert.h"

using namespace arrow::py;

namespace arrow {
namespace py {

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

} // namespace arrow
} // namespace py
} // namespace arrow
4 changes: 3 additions & 1 deletion cpp/src/arrow/python/arrow_to_python.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extern PyObject* pyarrow_deserialize_callback;
}

namespace arrow {
namespace py {

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

} // namespace arrow
} // namespace py
} // namespace arrow

#endif // ARROW_PYTHON_ARROW_TO_PYTHON_H
4 changes: 3 additions & 1 deletion cpp/src/arrow/python/dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <vector>

namespace arrow {
namespace py {

Status DictBuilder::Finish(std::shared_ptr<Array> key_tuple_data,
std::shared_ptr<Array> key_dict_data, std::shared_ptr<Array> val_list_data,
Expand All @@ -40,4 +41,5 @@ Status DictBuilder::Finish(std::shared_ptr<Array> key_tuple_data,
return Status::OK();
}

} // namespace arrow
} // namespace py
} // namespace arrow
4 changes: 3 additions & 1 deletion cpp/src/arrow/python/dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "arrow/python/sequence.h"

namespace arrow {
namespace py {

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

} // namespace arrow
} // namespace py
} // namespace arrow

#endif // PYARROW_DICT_H
4 changes: 2 additions & 2 deletions cpp/src/arrow/python/python_to_arrow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ extern "C" {
PyObject* pyarrow_deserialize_callback = NULL;
}

using namespace arrow::py;

namespace arrow {
namespace py {

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

} // namespace py
} // namespace arrow
4 changes: 3 additions & 1 deletion cpp/src/arrow/python/python_to_arrow.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ extern PyObject* pyarrow_deserialize_callback;
}

namespace arrow {
namespace py {

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

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

} // namespace arrow
} // namespace py
} // namespace arrow

#endif // ARROW_PYTHON_PYTHON_TO_ARROW_H
2 changes: 2 additions & 0 deletions cpp/src/arrow/python/scalars.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "arrow/python/sequence.h"

namespace arrow {
namespace py {

Status AppendScalar(PyObject* obj, SequenceBuilder& builder) {
if (PyArray_IsScalar(obj, Bool)) {
Expand Down Expand Up @@ -63,6 +64,7 @@ Status AppendScalar(PyObject* obj, SequenceBuilder& builder) {
return builder.AppendInt64(value);
}

} // namespace py
} // namespace arrow

#endif // PYTHON_ARROW_SCALARS_H
4 changes: 3 additions & 1 deletion cpp/src/arrow/python/sequence.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "arrow/python/sequence.h"

namespace arrow {
namespace py {

SequenceBuilder::SequenceBuilder(MemoryPool* pool)
: pool_(pool),
Expand Down Expand Up @@ -162,4 +163,5 @@ Status SequenceBuilder::Finish(std::shared_ptr<Array> list_data,
return Status::OK();
}

} // namespace arrow
} // namespace py
} // namespace arrow
2 changes: 2 additions & 0 deletions cpp/src/arrow/python/sequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "arrow/util/logging.h"

namespace arrow {
namespace py {

class NullArrayBuilder : public arrow::ArrayBuilder {
public:
Expand Down Expand Up @@ -136,6 +137,7 @@ class SequenceBuilder {
int8_t num_tags = 0;
};

} // namespace py
} // namespace arrow

#endif // PYTHON_ARROW_SEQUENCE_H
6 changes: 4 additions & 2 deletions python/pyarrow/serialization.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ except ImportError:

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

cdef extern from "arrow/python/python_to_arrow.h":
cdef extern from "arrow/python/python_to_arrow.h" namespace 'arrow::py':

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

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

cdef extern from "arrow/python/python_to_arrow.h":

cdef extern PyObject *pyarrow_serialize_callback

cdef extern PyObject *pyarrow_deserialize_callback

cdef extern from "arrow/python/arrow_to_python.h":
cdef extern from "arrow/python/arrow_to_python.h" namespace 'arrow::py':

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

0 comments on commit 2e08de4

Please sign in to comment.