Skip to content

Commit

Permalink
Avoid using deprecated BufferReader constructor in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pitrou committed Aug 8, 2024
1 parent 0019b58 commit 190f33c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cpp/src/arrow/dataset/dataset_writer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class DatasetWriterTestFixture : public testing::Test {

std::shared_ptr<RecordBatch> ReadAsBatch(std::string_view data, int* num_batches) {
std::shared_ptr<io::RandomAccessFile> in_stream =
std::make_shared<io::BufferReader>(data);
std::make_shared<io::BufferReader>(std::make_shared<Buffer>(data));
EXPECT_OK_AND_ASSIGN(std::shared_ptr<ipc::RecordBatchFileReader> reader,
ipc::RecordBatchFileReader::Open(in_stream));
RecordBatchVector batches;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/io/compressed_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ TEST_P(CompressedOutputStreamTest, RandomData) {
TEST(TestSnappyInputStream, NotImplemented) {
std::unique_ptr<Codec> codec;
ASSERT_OK_AND_ASSIGN(codec, Codec::Create(Compression::SNAPPY));
std::shared_ptr<InputStream> stream = std::make_shared<BufferReader>("");
std::shared_ptr<InputStream> stream = BufferReader::FromString("");
ASSERT_RAISES(NotImplemented, CompressedInputStream::Make(codec.get(), stream));
}

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/io/memory_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ template <typename SlowStreamType>
void TestSlowInputStream() {
using clock = std::chrono::high_resolution_clock;

auto stream = std::make_shared<BufferReader>(std::string_view("abcdefghijkl"));
std::shared_ptr<RandomAccessFile> stream = BufferReader::FromString("abcdefghijkl");
const double latency = 0.6;
auto slow = std::make_shared<SlowStreamType>(stream, latency);

Expand Down Expand Up @@ -519,7 +519,7 @@ class TestTransformInputStream : public ::testing::Test {
TransformInputStream::TransformFunc transform() const { return T(); }

void TestEmptyStream() {
auto wrapped = std::make_shared<BufferReader>(std::string_view());
std::shared_ptr<InputStream> wrapped = BufferReader::FromString({});
auto stream = std::make_shared<TransformInputStream>(wrapped, transform());

ASSERT_OK_AND_EQ(0, stream->Tell());
Expand Down Expand Up @@ -797,7 +797,7 @@ TEST(RangeReadCache, Basics) {
TEST(RangeReadCache, Concurrency) {
std::string data = "abcdefghijklmnopqrstuvwxyz";

auto file = std::make_shared<BufferReader>(Buffer(data));
auto file = std::make_shared<BufferReader>(std::make_shared<Buffer>(data));
std::vector<ReadRange> ranges{{1, 2}, {3, 2}, {8, 2}, {20, 2},
{25, 0}, {10, 4}, {14, 0}, {15, 4}};

Expand Down

0 comments on commit 190f33c

Please sign in to comment.