Defer REGISTRY import to fix empty validator snapshot#139
Open
Defer REGISTRY import to fix empty validator snapshot#139
Conversation
3db2dcd to
339caee
Compare
The query-language REGISTRY snapshots ValidatorRegistry.get_instance() at import time. This import is triggered during engine bootstrap before bootstrap_ast_validators() populates the singleton, resulting in an empty REGISTRY and KeyError in DruidQueryTransformer on UDF queries. Move the REGISTRY import into parse_query_to_validated_ast so the snapshot is taken at first use (request time) when validators are already registered.
339caee to
c9e17cc
Compare
EXBreder
approved these changes
Feb 20, 2026
jani745765-netizen
approved these changes
Feb 26, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Move the
REGISTRYimport from module-level to insideparse_query_to_validated_ast().Problem
The query-language
REGISTRYinast_validator.pysnapshotsValidatorRegistry.get_instance()at module import time. This import is triggered during engine bootstrap (viaplugin_managerimport chain) beforebootstrap_ast_validators()populates the singleton. The snapshot captures an empty registry, soDruidQueryTransformer.transform_Callfails withKeyErroron queries with UDF calls (e.g.DidAddLabel(...)).Fix
Defer the
REGISTRYimport in__init__.pyfrom module-level to insideparse_query_to_validated_ast(). The snapshot is then taken at first call (request time) when validators are already registered. One line removed, one line added.Test plan