-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Support WASB scheme in ADLSFileIO #11830
Merged
amogh-jahagirdar
merged 5 commits into
apache:main
from
mrcnc:support-wasb-for-adlsfileio
Jan 20, 2025
+83
−12
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f9e6059
Support WASB scheme in ADLSFileIO (#11504)
mrcnc b86d376
Add test for applyClientConfiguration from ADLSFileIO
mrcnc 0538317
Add fix for applyClientConfiguration from ADLSFileIO
mrcnc 8a64989
Update test to use equality instead of containment check
mrcnc e6d6c72
Add test for secure version of protocols
mrcnc 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 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 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 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 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 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 |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
import org.apache.iceberg.exceptions.ValidationException; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
|
||
public class ADLSLocationTest { | ||
|
@@ -33,7 +34,18 @@ public void testLocationParsing(String scheme) { | |
String p1 = scheme + "://[email protected]/path/to/file"; | ||
ADLSLocation location = new ADLSLocation(p1); | ||
|
||
assertThat(location.storageAccount()).isEqualTo("account.dfs.core.windows.net"); | ||
assertThat(location.storageAccount()).isEqualTo("account"); | ||
assertThat(location.container().get()).isEqualTo("container"); | ||
assertThat(location.path()).isEqualTo("path/to/file"); | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"wasb", "wasbs"}) | ||
public void testWasbLocatonParsing(String scheme) { | ||
String p1 = scheme + "://[email protected]/path/to/file"; | ||
ADLSLocation location = new ADLSLocation(p1); | ||
|
||
assertThat(location.storageAccount()).isEqualTo("account"); | ||
assertThat(location.container().get()).isEqualTo("container"); | ||
assertThat(location.path()).isEqualTo("path/to/file"); | ||
} | ||
|
@@ -43,7 +55,7 @@ public void testEncodedString() { | |
String p1 = "abfs://[email protected]/path%20to%20file"; | ||
ADLSLocation location = new ADLSLocation(p1); | ||
|
||
assertThat(location.storageAccount()).isEqualTo("account.dfs.core.windows.net"); | ||
assertThat(location.storageAccount()).isEqualTo("account"); | ||
assertThat(location.container().get()).isEqualTo("container"); | ||
assertThat(location.path()).isEqualTo("path%20to%20file"); | ||
} | ||
|
@@ -67,7 +79,7 @@ public void testNoContainer() { | |
String p1 = "abfs://account.dfs.core.windows.net/path/to/file"; | ||
ADLSLocation location = new ADLSLocation(p1); | ||
|
||
assertThat(location.storageAccount()).isEqualTo("account.dfs.core.windows.net"); | ||
assertThat(location.storageAccount()).isEqualTo("account"); | ||
assertThat(location.container().isPresent()).isFalse(); | ||
assertThat(location.path()).isEqualTo("path/to/file"); | ||
} | ||
|
@@ -77,7 +89,7 @@ public void testNoPath() { | |
String p1 = "abfs://[email protected]"; | ||
ADLSLocation location = new ADLSLocation(p1); | ||
|
||
assertThat(location.storageAccount()).isEqualTo("account.dfs.core.windows.net"); | ||
assertThat(location.storageAccount()).isEqualTo("account"); | ||
assertThat(location.container().get()).isEqualTo("container"); | ||
assertThat(location.path()).isEqualTo(""); | ||
} | ||
|
@@ -89,4 +101,19 @@ public void testQuestionMarkInFileName(String path) { | |
ADLSLocation location = new ADLSLocation(fullPath); | ||
assertThat(location.path()).contains(path); | ||
} | ||
|
||
@ParameterizedTest | ||
@CsvSource({ | ||
"abfs://[email protected]/file.txt, account.dfs.core.windows.net", | ||
"abfs://[email protected]/file.txt, account.dfs.core.usgovcloudapi.net", | ||
"wasb://[email protected]/file.txt, account.blob.core.windows.net", | ||
"abfs://account.dfs.core.windows.net/path, account.dfs.core.windows.net", | ||
"abfss://account.dfs.core.windows.net/path, account.dfs.core.windows.net", | ||
"wasb://account.blob.core.windows.net/path, account.blob.core.windows.net", | ||
"wasbs://account.blob.core.windows.net/path, account.blob.core.windows.net" | ||
}) | ||
void testHost(String path, String expectedHost) { | ||
ADLSLocation location = new ADLSLocation(path); | ||
assertThat(location.host()).isEqualTo(expectedHost); | ||
} | ||
} |
This file contains 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
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 would like to verify that updating this default behavior of ResolvingFileIO is not considered a breaking change, since it could potentially force clients using the WASB scheme with HadoopFileIO to update their configuration. For example, if clients are currently using SAS tokens in an core-site.xml file, then it seems they need to either configure these in the AzureProperties for ADLSFileIO or explicitly configure HadoopFileIO as the implementation to get the same behavior.
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.
Not completely sure I follow the concern, if a client is using WASB + HadoopFileIO this means they explicitly configured it or are using a catalog which defaults to using HadoopFileIO (e.g. the
HadoopCatalog
).Adding this scheme mapping to
ResolvingFileIO
just makes it so that when ResolvingFileIO is configured or defaulted to, if a path with "wasb/wasbs" is encountered, we initialize the ADLS file IO. It shouldn't impact a user who has already either explicitly configured HadoopFileIO or is defaulting to that. Unless I'm missing something cc @danielcweeks @bryanckThere 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 see the JdbcCatalog uses HadoopFileIO by default so it wouldn't affect these users, but it would affect the REST Catalog which defaults to ResolvingFileIO. Maybe this is ok but needs to be added to release notes for 1.8.0? If not, we can remove it for now or activate this behavior explicitly with another setting?
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 think it's actually important to update the mapping (so imo what's here is correct). I think ResolvingFileIO should always only fallback to HadoopFileIO as a last resort, and in this case we do want wasb/wasbs to resolve to ADLS so that any custom integrations that happens in Iceberg in the ADLSFileIO implementation can be taken advantage of. At the same time we should document it.
In general, I feel like we shouldn't design for the case where a user relies on ResolvingFileIO's fallback HadoopFileIO
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.
The mapping should be updated imho. This change makes sense to me here.