Skip to content

Commit

Permalink
Keeps compatible with apache-arrow 9.0.0. (#895)
Browse files Browse the repository at this point in the history
Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
  • Loading branch information
sighingnow authored Aug 4, 2022
1 parent 1ada72c commit 54768dc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-10.15]
os: [ubuntu-18.04, macos-11]
arrow: [none, 1.0.1-1, 2.0.0-1, 3.0.0-1]
exclude:
- os: ubuntu-18.04
Expand Down
2 changes: 1 addition & 1 deletion docker/vineyardd/Dockerfile.alpine-builder
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ RUN cd /tmp && \
mkdir build && \
cd build && \
cmake ../cpp \
-DARROW_COMPUTE=OFF \
-DARROW_COMPUTE=ON \
-DARROW_WITH_UTF8PROC=OFF \
-DARROW_CSV=ON \
-DARROW_CUDA=OFF \
Expand Down
15 changes: 15 additions & 0 deletions modules/basic/ds/arrow_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,13 @@ Status SerializeRecordBatch(std::shared_ptr<arrow::RecordBatch>& batch,
std::shared_ptr<arrow::io::BufferOutputStream> out_stream;
RETURN_ON_ARROW_ERROR_AND_ASSIGN(out_stream,
arrow::io::BufferOutputStream::Create(1024));
#if defined(ARROW_VERSION) && ARROW_VERSION < 9000000
RETURN_ON_ARROW_ERROR(arrow::ipc::WriteRecordBatchStream(
{batch}, arrow::ipc::IpcOptions::Defaults(), out_stream.get()));
#else
RETURN_ON_ARROW_ERROR(arrow::ipc::WriteRecordBatchStream(
{batch}, arrow::ipc::IpcWriteOptions::Defaults(), out_stream.get()));
#endif
RETURN_ON_ARROW_ERROR_AND_ASSIGN(*buffer, out_stream->Finish());
return Status::OK();
}
Expand All @@ -107,8 +112,13 @@ Status SerializeRecordBatchesToAllocatedBuffer(
const std::vector<std::shared_ptr<arrow::RecordBatch>>& batches,
std::shared_ptr<arrow::Buffer>* buffer) {
arrow::io::FixedSizeBufferWriter stream(*buffer);
#if defined(ARROW_VERSION) && ARROW_VERSION < 9000000
RETURN_ON_ARROW_ERROR(arrow::ipc::WriteRecordBatchStream(
batches, arrow::ipc::IpcOptions::Defaults(), &stream));
#else
RETURN_ON_ARROW_ERROR(arrow::ipc::WriteRecordBatchStream(
batches, arrow::ipc::IpcWriteOptions::Defaults(), &stream));
#endif
return Status::OK();
}

Expand All @@ -118,8 +128,13 @@ Status SerializeRecordBatches(
std::shared_ptr<arrow::io::BufferOutputStream> out_stream;
RETURN_ON_ARROW_ERROR_AND_ASSIGN(out_stream,
arrow::io::BufferOutputStream::Create(1024));
#if defined(ARROW_VERSION) && ARROW_VERSION < 9000000
RETURN_ON_ARROW_ERROR(arrow::ipc::WriteRecordBatchStream(
batches, arrow::ipc::IpcOptions::Defaults(), out_stream.get()));
#else
RETURN_ON_ARROW_ERROR(arrow::ipc::WriteRecordBatchStream(
batches, arrow::ipc::IpcWriteOptions::Defaults(), out_stream.get()));
#endif
RETURN_ON_ARROW_ERROR_AND_ASSIGN(*buffer, out_stream->Finish());
return Status::OK();
}
Expand Down

0 comments on commit 54768dc

Please sign in to comment.