damccorm commented on code in PR #41268:
URL: https://github.com/apache/beam/pull/41268#discussion_r4559826956
##########
sdks/python/apache_beam/io/filesystems.py:
##########
@@ -131,10 +135,14 @@ def get_filesystem(path):
"""
try:
path_scheme = FileSystems.get_scheme(path)
- systems = [
- fs for fs in FileSystem.get_all_subclasses()
- if fs.scheme() == path_scheme
- ]
+ direct_subclasses = FileSystem.__subclasses__()
+ if FileSystems._direct_subclasses_cache != direct_subclasses:
+ by_scheme = {}
+ for fs in FileSystem.get_all_subclasses():
Review Comment:
Ack — all built-in and plugin `FileSystem` implementations in Beam subclass
`FileSystem` directly, and `BeamPlugin.get_all_subclasses()` previously called
`fs.scheme()` across all subclasses on every lookup (so intermediate abstract
subclasses without `scheme()` were already not supported). Checking
`FileSystem.__subclasses__()` handles dynamic direct subclass registration in
tests while keeping the hot path O(1).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]