-
Notifications
You must be signed in to change notification settings - Fork 229
feat(io): split io/gocloud into per-cloud backend packages #1961
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
Merged
laskoviymishka
merged 5 commits into
apache:main
from
badalprasadsingh:feat/split-per-cloud-backends
Aug 31, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a264a65
feat: split into per-cloud backend packages
badalprasadsingh 6541633
Merge remote-tracking branch 'origin/main' into feat/split-per-cloud-…
badalprasadsingh 6f30bd7
Merge remote-tracking branch 'origin/main' into feat/split-per-cloud-…
badalprasadsingh 4b80d2d
fix: minor
badalprasadsingh 5c74dde
fix: remove of fileio
badalprasadsingh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| // The integration build blank-imports io/gocloud, which registers the schemes | ||
| // this file asserts are absent. | ||
| //go:build !integration | ||
|
|
||
| package hadoop | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
|
|
||
| "github.com/apache/iceberg-go/internal/schemes" | ||
| icebergio "github.com/apache/iceberg-go/io" | ||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestImportRegistersNoCloudSchemes(t *testing.T) { | ||
| registered := icebergio.GetRegisteredSchemes() | ||
| for _, list := range [][]string{schemes.S3, schemes.GCS, schemes.Azure} { | ||
| for _, scheme := range list { | ||
| assert.NotContains(t, registered, scheme) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| func TestLoadFSCloudPathReportsMissingBackend(t *testing.T) { | ||
| for _, tt := range []struct { | ||
| location string | ||
| wantHint string | ||
| }{ | ||
| {"s3://bucket/key", "io/gocloud/s3"}, | ||
| {"gs://bucket/key", "io/gocloud/gcs"}, | ||
| {"abfs://container@account.dfs.core.windows.net/key", "io/gocloud/azure"}, | ||
| } { | ||
| t.Run(tt.location, func(t *testing.T) { | ||
| _, err := icebergio.LoadFS(context.Background(), nil, tt.location) | ||
| require.ErrorIs(t, err, icebergio.ErrIOSchemeNotFound) | ||
| assert.ErrorContains(t, err, tt.wantHint) | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package schemes | ||
|
|
||
| import "slices" | ||
|
|
||
| // S3 covers oss because Alibaba OSS is reached through its S3-compatible API and the AWS SDK. | ||
| // Unlike Java, which has a dedicated OSSFileIO. | ||
| // OSS users here configure s3.* credential keys, not oss.*. | ||
| var ( | ||
| S3 = []string{"s3", "s3a", "s3n", "oss"} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth a doc comment on this slice: |
||
| GCS = []string{"gs"} | ||
| Azure = []string{"abfs", "abfss", "wasb", "wasbs"} | ||
| ) | ||
|
|
||
| // BackendFor returns the io/gocloud subpackage that registers scheme, or | ||
| // an empty string if no backend claims it. | ||
| func BackendFor(scheme string) string { | ||
| switch { | ||
| case slices.Contains(S3, scheme): | ||
| return "s3" | ||
| case slices.Contains(GCS, scheme): | ||
| return "gcs" | ||
| case slices.Contains(Azure, scheme): | ||
| return "azure" | ||
| default: | ||
| return "" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| // Package azure provides the FileIO backend for Azure Data Lake Storage and Blob Storage. | ||
| // Import it for its side effects to register the abfs, abfss, wasb and wasbs schemes without linking the other clouds' | ||
| // SDKs: | ||
| // | ||
| // import _ "github.com/apache/iceberg-go/io/gocloud/azure" | ||
| package azure | ||
|
|
||
| import ( | ||
| "context" | ||
| "net/url" | ||
|
|
||
| "github.com/apache/iceberg-go/internal/schemes" | ||
| "github.com/apache/iceberg-go/io" | ||
| "github.com/apache/iceberg-go/io/gocloud/blobfs" | ||
| ) | ||
|
|
||
| func init() { | ||
| factory := func(ctx context.Context, parsed *url.URL, props map[string]string) (io.IO, error) { | ||
| bucket, err := createAzureBucket(ctx, parsed, props) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| return blobfs.New(ctx, bucket, adlsObjectLocationExtractor(parsed)), nil | ||
| } | ||
|
|
||
| for _, scheme := range schemes.Azure { | ||
| io.Register(scheme, factory) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd hold on this import swap until we decide what happens to scheme registration for
catalog/hadoopusers.Today the value import of
io/gocloudpulls in that package'sinit(), so anyone importingcatalog/hadoopgets all nine cloud schemes registered for free. Swapping toblobfs(which has no registrationinit()) means a program that imports onlycatalog/hadoopand talks to s3/gcs/azure will now build fine and then fail at the firstLoadFSwithErrIOSchemeNotFound. That's a silent runtime regression ongo get -u, with no compile-time signal.I think the split itself is right, so I wouldn't want to re-link all three SDKs into hadoop just to preserve the old behavior. But we shouldn't let it break silently either. Either keep a blank import of
io/gocloudhere, or treat this as an intentional break and call it out loudly in the CHANGELOG and package doc (the website config page alone won't reach someone upgrading). wdyt?