Skip to content

fix: Azure URI parsing with KeyExtractor function for blobFileIO preprocessing - #562

Merged
zeroshade merged 3 commits into
apache:mainfrom
DataDog:anori/fix_blob_preprocess_azure
Sep 15, 2025
Merged

zeroshade merged 3 commits into
apache:mainfrom
DataDog:anori/fix_blob_preprocess_azure

Conversation

@alessandro-nori

@alessandro-nori alessandro-nori commented Sep 12, 2025 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace bucketName field with injectable KeyExtractor function in blobFileIO
  • Add adlsKeyExtractor for Azure schemes using regex pattern from Java implementation

Testing

  • All existing tests pass
  • New unit tests for defaultKeyExtractor and adlsKeyExtractor

Fixes #561

@alessandro-nori
alessandro-nori force-pushed the anori/fix_blob_preprocess_azure branch from 9efcfa6 to dde5fd8 Compare September 12, 2025 12:39
@alessandro-nori
alessandro-nori marked this pull request as ready for review September 12, 2025 12:40
@alessandro-nori alessandro-nori changed the title refactor: replace bucketName with KeyExtractor function for URI preprocessing fix: Azure URI parsing with KeyExtractor function for URI preprocessing Sep 12, 2025
@alessandro-nori alessandro-nori changed the title fix: Azure URI parsing with KeyExtractor function for URI preprocessing fix: Azure URI parsing with KeyExtractor function for blobFileIO preprocessing Sep 12, 2025
@alessandro-nori alessandro-nori changed the title fix: Azure URI parsing with KeyExtractor function for blobFileIO preprocessing fix: Azure URI parsing with KeyExtractor function for blobFileIO preprocessing Sep 12, 2025
Comment thread io/azure.go Resolved
Comment thread io/azure_test.go Outdated
Comment on lines +179 to +181
name: "URI with no path",
input: "abfs://[email protected]",
expectedKey: "",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this no error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I followed the Java implementation and it returns an empty string in case of empty/null path.
https://github.com/apache/iceberg/blob/723d0998d69f254822efd6f8939e71c0723aaab2/azure/src/main/java/org/apache/iceberg/azure/adlsv2/ADLSLocation.java#L79

I think in our specific case it is ok to return an error and I'll update the code if we agree on it

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think an error would be helpful here b/c it's not a valid location for any file that would be tracked in an Iceberg table. Also, the Java implementation could improve its validation logic so there's not a strong reason to copy it here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree, let's update this to return an error in this case

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me, just the one nitpick to add an error for the empty path case

@alessandro-nori
alessandro-nori force-pushed the anori/fix_blob_preprocess_azure branch from af6cd73 to a1b2f69 Compare September 14, 2025 06:29
@zeroshade
zeroshade merged commit 3c6b914 into apache:main Sep 15, 2025
@laskoviymishka laskoviymishka mentioned this pull request Apr 3, 2026
96 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure Blob Storage URI Handling in createBlobFs Causes Incorrect Paths and Metadata Mismatch

4 participants