Skip to content

Commit

Permalink
Further PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
OliLay committed Aug 14, 2024
1 parent 48bc6be commit 4215eb3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
13 changes: 8 additions & 5 deletions cpp/src/arrow/filesystem/azurefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ Status AzureOptions::ExtractFromUriQuery(const Uri& uri) {
blob_storage_scheme = "http";
dfs_storage_scheme = "http";
}
} else if (kv.first == "background_writes") {
ARROW_ASSIGN_OR_RAISE(background_writes,
::arrow::internal::ParseBoolean(kv.second));
} else {
return Status::Invalid(
"Unexpected query parameter in Azure Blob File System URI: '", kv.first, "'");
Expand Down Expand Up @@ -973,6 +976,10 @@ class ObjectAppendStream final : public io::OutputStream {
private:
struct UploadState;

std::shared_ptr<ObjectAppendStream> Self() {
return std::dynamic_pointer_cast<ObjectAppendStream>(shared_from_this());
}

public:
ObjectAppendStream(std::shared_ptr<Blobs::BlockBlobClient> block_blob_client,
const io::IOContext& io_context, const AzureLocation& location,
Expand Down Expand Up @@ -1044,10 +1051,6 @@ class ObjectAppendStream final : public io::OutputStream {
return Status::OK();
}

std::shared_ptr<ObjectAppendStream> Self() {
return std::dynamic_pointer_cast<ObjectAppendStream>(shared_from_this());
}

Status Abort() override {
if (closed_) {
return Status::OK();
Expand Down Expand Up @@ -1132,7 +1135,7 @@ class ObjectAppendStream final : public io::OutputStream {
}

Future<> FlushAsync() {
RETURN_NOT_OK(CheckClosed("flushAsync"));
RETURN_NOT_OK(CheckClosed("flush async"));
if (!initialised_) {
// If the stream has not been successfully initialized then there is nothing to
// flush. This also avoids some unhandled errors when flushing in the destructor.
Expand Down
14 changes: 13 additions & 1 deletion cpp/src/arrow/filesystem/azurefs_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,16 @@ class TestAzureOptions : public ::testing::Test {
ASSERT_EQ(path, "container/dir/blob");
}

void TestFromUriEnableBackgroundWrites() {
std::string path;
ASSERT_OK_AND_ASSIGN(auto options,
AzureOptions::FromUri(
"abfs://account:[email protected]:10000/container/dir/blob?"
"background_writes=true",
&path));
ASSERT_EQ(options.background_writes, true);
}

void TestFromUriCredentialDefault() {
ASSERT_OK_AND_ASSIGN(
auto options,
Expand Down Expand Up @@ -771,6 +781,9 @@ TEST_F(TestAzureOptions, FromUriDfsStorage) { TestFromUriDfsStorage(); }
TEST_F(TestAzureOptions, FromUriAbfs) { TestFromUriAbfs(); }
TEST_F(TestAzureOptions, FromUriAbfss) { TestFromUriAbfss(); }
TEST_F(TestAzureOptions, FromUriEnableTls) { TestFromUriEnableTls(); }
TEST_F(TestAzureOptions, FromUriEnableBackgroundWrites) {
TestFromUriEnableBackgroundWrites();
}
TEST_F(TestAzureOptions, FromUriCredentialDefault) { TestFromUriCredentialDefault(); }
TEST_F(TestAzureOptions, FromUriCredentialAnonymous) { TestFromUriCredentialAnonymous(); }
TEST_F(TestAzureOptions, FromUriCredentialStorageSharedKey) {
Expand Down Expand Up @@ -1480,7 +1493,6 @@ class TestAzureFileSystem : public ::testing::Test {
std::shared_ptr<Buffer> buffer;
do {
ASSERT_OK_AND_ASSIGN(buffer, input->Read(128 * 1024));
ASSERT_TRUE(buffer);
contents.append(buffer->ToString());
} while (buffer->size() != 0);

Expand Down

0 comments on commit 4215eb3

Please sign in to comment.