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.
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
Add a native function namespace manager #23358
base: master
Are you sure you want to change the base?
Add a native function namespace manager #23358
Changes from 1 commit
5eab56f
745c782
eeff0a5
35f7a48
3d9d985
4ca63ff
5567990
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
this class isn't really thread safe anymore because this field is mutable, and there are no guards on how it is read/written. It might be better to set the default namespace in FunctionsConfig instead of in the config for any particular function namespace. Then we also wouldn't need to check that there is only one.
Downside is that we will only fail later (at runtime?) if the default namespace doesn't exist (never gets loaded).
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.
also, let's change this name to defaultNamespace, as this isn't something that we expect to be updated. and change the static variable DEFAULT_NAMESPACE to something that's clearer now, e.g. JAVA_BUILTIN_NAMESPACE.
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.
Last comment about default_namespace, but have you checked all the things that are using DEFAULT_NAMESPACE right now? Is it still correct for them to do that?
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 change this to throw some kind of Presto user error if the functionNamespaceManager isn't present (maybe FUNCTION_NOT_FOUND error code)
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.
there's too many assumptions going on here now. this will throw an exception later if the fucntionNamepsaceManager here is not the DEFAULT or currentDefault.
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.
getDefaultNamespace()
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.
why do we use both DEFAULT_NAMESPACE and currentDefaultNamespace here?
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.
calling out to BuiltInTypeAndFunctionNamepsaceManager to use that functionality for other namespace managers seems to violate some of the boundaries of the abstraction. Maybe we should extract that specialized function cache logic out of BuiltInTypeAndFunctionNamespaceManager if it needs to be common to other function namespace managers.
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.
same comment about throwing a better error here instead of checkArgument.
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.
Call this
isDefaultNamespaceSet