Add ClassLoaderSafe ConnectorPlanOptimizer and SplitSource #24685
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.
Description
Adds a ClassLoaderSafeConnectorPlanOptimizer class and wraps the Iceberg connector optimizer rules with it. Additionally, we do the same the IcebergSplitSource.
Motivation and Context
This is required when plugin optimizer rules have a dependency which may rely on a properly set ContextClassloader in order to perform any of the optimizations.
In the case of Iceberg, there are cases when we can reach out for some of the table's metadata files which initiates calls to the FileSystem client. The Hadoop FileSystem Configuration object may use the ContextClassLoader to load the correct FileSystem client implementation. We found in production when many connectors are enabled and the query spans multiple connectors, there are cases where the ContextClassLoader may not be set properly resulting in ClassNotFound exceptions inside Hadoop's Configuration class.
Failure stacktrace from production
Impact
N/A
Test Plan
This was a difficult bug to trigger in production and it only happened periodically. I don't think we have a good way
to test this.
Contributor checklist
Release Notes