Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pcmoritz committed Aug 18, 2017
1 parent a6fdb76 commit 54af39b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cpp/src/arrow/python/arrow_to_python.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Status DeserializeDict(std::shared_ptr<Array> array, int64_t start_idx, int64_t
return Status::OK();
}

Status DeserializeArray(std::shared_ptr<Array> array, int32_t offset, PyObject* base,
Status DeserializeArray(std::shared_ptr<Array> array, int64_t offset, PyObject* base,
const std::vector<std::shared_ptr<arrow::Tensor>>& tensors,
PyObject** out) {
DCHECK(array);
Expand All @@ -87,15 +87,16 @@ Status DeserializeArray(std::shared_ptr<Array> array, int32_t offset, PyObject*
return Status::OK();
}

Status GetValue(std::shared_ptr<Array> arr, int32_t index, int32_t type, PyObject* base,
Status GetValue(std::shared_ptr<Array> arr, int64_t index, int32_t type, PyObject* base,
const std::vector<std::shared_ptr<Tensor>>& tensors, PyObject** result) {
switch (arr->type()->id()) {
case Type::BOOL:
*result =
PyBool_FromLong(std::static_pointer_cast<BooleanArray>(arr)->Value(index));
return Status::OK();
case Type::INT64:
*result = PyLong_FromSsize_t(std::static_pointer_cast<Int64Array>(arr)->Value(index));
*result =
PyLong_FromSsize_t(std::static_pointer_cast<Int64Array>(arr)->Value(index));
return Status::OK();
case Type::BINARY: {
int32_t nchars;
Expand Down Expand Up @@ -195,7 +196,7 @@ Status ReadSerializedPythonSequence(std::shared_ptr<io::RandomAccessFile> src,
RETURN_NOT_OK(ipc::RecordBatchStreamReader::Open(src, &reader));
RETURN_NOT_OK(reader->ReadNextRecordBatch(batch_out));
RETURN_NOT_OK(src->Tell(&offset));
offset += 4; // TODO(pcm): Why is this neccessary?
offset += 4; // Skip the end-of-stream message
for (int i = 0; i < num_tensors; ++i) {
std::shared_ptr<Tensor> tensor;
RETURN_NOT_OK(ipc::ReadTensor(offset, src.get(), &tensor));
Expand Down

0 comments on commit 54af39b

Please sign in to comment.