Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-32206: [C++] GcsFileSystem::Make should return Result #44503

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

trifleneurotic
Copy link

@trifleneurotic trifleneurotic commented Oct 22, 2024

This PR includes breaking changes to public APIs.

What changes are included in this PR?

GcsFileSystem::Make now returns Result, with corresponding header & test changes.

Are these changes tested?

Yes, arrow-gcsfs-test passed.

Are there any user-facing changes?

None known.

@trifleneurotic
Copy link
Author

GH-32206: Added back a line I had erroneously removed (port_ argument for storage-testbench).

@@ -962,7 +962,7 @@ Result<std::shared_ptr<io::OutputStream>> GcsFileSystem::OpenAppendStream(
return Status::NotImplemented("Append is not supported in GCS");
}

std::shared_ptr<GcsFileSystem> GcsFileSystem::Make(const GcsOptions& options,
Result<std::shared_ptr<GcsFileSystem>> GcsFileSystem::Make(const GcsOptions& options,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is for compatible reason? 🤔

Copy link
Author

@trifleneurotic trifleneurotic Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essentially that's correct, as per the original issue: "For consistency with S3FileSystem" which, incidentally, makes it consistent with other similar filesystem classes.

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Oct 23, 2024
Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gcsfs.h is a public header. So this is a breaking change. Could you keep **This PR includes breaking changes to public APIs.** in the pull request template?

@@ -232,7 +232,7 @@ class ARROW_EXPORT GcsFileSystem : public FileSystem {

/// Create a GcsFileSystem instance from the given options.
// TODO(ARROW-16884): make this return Result for consistency
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove this comment?

Copy link
Author

@trifleneurotic trifleneurotic Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete! Ref 49fd6d0 (EDIT: incorrect commit hash).

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Oct 23, 2024
@@ -271,7 +271,7 @@ class TestGCSFSGeneric : public GcsIntegrationTest, public GenericFileSystemTest
void SetUp() override {
ASSERT_NO_FATAL_FAILURE(GcsIntegrationTest::SetUp());
auto bucket_name = RandomBucketName();
gcs_fs_ = GcsFileSystem::Make(TestGcsOptions());
ASSERT_OK_AND_ASSIGN(std::shared_ptr<GcsFileSystem> gcs_fs_, GcsFileSystem::Make(TestGcsOptions()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ASSERT_OK_AND_ASSIGN(std::shared_ptr<GcsFileSystem> gcs_fs_, GcsFileSystem::Make(TestGcsOptions()));
ASSERT_OK_AND_ASSIGN(gcs_fs_, GcsFileSystem::Make(TestGcsOptions()));

Copy link
Author

@trifleneurotic trifleneurotic Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete! Ref 49fd6d0 (EDIT: incorrect commit hash).

@@ -489,17 +489,13 @@ TEST(GcsFileSystem, FileSystemCompare) {
a_options.project_id = "test-only-invalid-project-id";
auto a = GcsFileSystem::Make(a_options);
EXPECT_THAT(a, NotNull());
EXPECT_TRUE(a->Equals(*a));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to remove this?

Should we change auto a = GcsFileSystem::Make(a_options); to ASSERT_OK_AND_ASSIGN(auto a, GcsFileSystem::Make(a_options); instead?

Copy link
Author

@trifleneurotic trifleneurotic Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to remove this with your suggested change. That change has been made, and the above line has been restored. Ref 49fd6d0 (EDIT: incorrect commit hash).

@@ -622,7 +618,7 @@ TEST(GcsFileSystem, ObjectMetadataRoundtrip) {
}

TEST_F(GcsIntegrationTest, GetFileInfoBucket) {
auto fs = GcsFileSystem::Make(TestGcsOptions());
ASSERT_OK_AND_ASSIGN(std::shared_ptr<GcsFileSystem> fs, GcsFileSystem::Make(TestGcsOptions()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you keep using auto?

Copy link
Author

@trifleneurotic trifleneurotic Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete! Ref 49fd6d0 (EDIT: incorrect commit hash).

@trifleneurotic
Copy link
Author

gcsfs.h is a public header. So this is a breaking change. Could you keep **This PR includes breaking changes to public APIs.** in the pull request template?

This has been done.

@trifleneurotic
Copy link
Author

trifleneurotic commented Oct 23, 2024

Tests were re-run locally as a result of the local compilation of commit 49fd6d0; arrow-gcsfs-test was successful. (EDIT: incorrect commit hash).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants