Skip to content

Commit

Permalink
Post rebase changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rok committed Sep 11, 2024
1 parent 2cfc678 commit ff357e3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
5 changes: 3 additions & 2 deletions cpp/src/arrow/extension/tensor_extension_array_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
namespace arrow {

using FixedShapeTensorType = extension::FixedShapeTensorType;
using arrow::ipc::test::RoundtripBatch;
using extension::fixed_shape_tensor;
using extension::FixedShapeTensorArray;

Expand Down Expand Up @@ -781,7 +782,7 @@ TEST_F(TestVariableShapeTensorType, RoudtripBatch) {
std::shared_ptr<RecordBatch> read_batch;
auto ext_field = field(/*name=*/"f0", /*type=*/ext_type_);
auto batch = RecordBatch::Make(schema({ext_field}), ext_arr_->length(), {ext_arr_});
RoundtripBatch(batch, &read_batch);
ASSERT_OK(RoundtripBatch(batch, &read_batch));
CompareBatch(*batch, *read_batch, /*compare_metadata=*/true);

// Pass extension metadata and storage array, expect getting back extension array
Expand All @@ -792,7 +793,7 @@ TEST_F(TestVariableShapeTensorType, RoudtripBatch) {
ext_field = field(/*name=*/"f0", /*type=*/ext_type_->storage_type(), /*nullable=*/true,
/*metadata=*/ext_metadata);
auto batch2 = RecordBatch::Make(schema({ext_field}), ext_arr_->length(), {ext_arr_});
RoundtripBatch(batch2, &read_batch2);
ASSERT_OK(RoundtripBatch(batch2, &read_batch2));
CompareBatch(*batch, *read_batch2, /*compare_metadata=*/true);
}

Expand Down
2 changes: 2 additions & 0 deletions cpp/src/arrow/extension/uuid_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

namespace arrow {

using arrow::ipc::test::RoundtripBatch;

TEST(TestUuuidExtensionType, ExtensionTypeTest) {
auto type = uuid();
ASSERT_EQ(type->id(), Type::EXTENSION);
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/arrow/extension_type_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include "arrow/util/key_value_metadata.h"
#include "arrow/util/logging.h"

using arrow::ipc::test::RoundtripBatch;

namespace arrow {

class Parametric1Array : public ExtensionArray {
Expand Down
14 changes: 0 additions & 14 deletions cpp/src/arrow/testing/gtest_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -591,20 +591,6 @@ void ApproxCompareBatch(const RecordBatch& left, const RecordBatch& right,
});
}

void RoundtripBatch(const std::shared_ptr<RecordBatch>& batch,
std::shared_ptr<RecordBatch>* out) {
ASSERT_OK_AND_ASSIGN(auto out_stream, io::BufferOutputStream::Create());
ASSERT_OK(ipc::WriteRecordBatchStream({batch}, ipc::IpcWriteOptions::Defaults(),
out_stream.get()));

ASSERT_OK_AND_ASSIGN(auto complete_ipc_stream, out_stream->Finish());

io::BufferReader reader(complete_ipc_stream);
std::shared_ptr<RecordBatchReader> batch_reader;
ASSERT_OK_AND_ASSIGN(batch_reader, ipc::RecordBatchStreamReader::Open(&reader));
ASSERT_OK(batch_reader->ReadNext(out));
}

std::shared_ptr<Array> TweakValidityBit(const std::shared_ptr<Array>& array,
int64_t index, bool validity) {
auto data = array->data()->Copy();
Expand Down
3 changes: 0 additions & 3 deletions cpp/src/arrow/testing/gtest_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,6 @@ ARROW_TESTING_EXPORT void ApproxCompareBatch(
const RecordBatch& left, const RecordBatch& right, bool compare_metadata = true,
const EqualOptions& options = TestingEqualOptions());

ARROW_TESTING_EXPORT void RoundtripBatch(const std::shared_ptr<RecordBatch>& batch,
std::shared_ptr<RecordBatch>* out);

// Check if the padding of the buffers of the array is zero.
// Also cause valgrind warnings if the padding bytes are uninitialized.
ARROW_TESTING_EXPORT void AssertZeroPadded(const Array& array);
Expand Down

0 comments on commit ff357e3

Please sign in to comment.