feat: Add support for registering components dynamically#11439
feat: Add support for registering components dynamically#11439soumiiow wants to merge 1 commit intofacebookincubator:mainfrom
Conversation
✅ Deploy Preview for meta-velox canceled.
|
|
@soumiiow thanks for looking into this. Out of curiosity, why doesn't this work in MacOS? |
velox/common/CMakeLists.txt
Outdated
There was a problem hiding this comment.
we use snake case for directory names "dynamic_registry"
pedroerp
left a comment
There was a problem hiding this comment.
Very cool! I few small comments but overall looks good.
There was a problem hiding this comment.
nit: new line before namespace definition.
There was a problem hiding this comment.
for consistency, could you use LOG(INFO) and print the file name / path of the library loaded?
There was a problem hiding this comment.
we can probably omit the "Functions" from the name, and this can be used to really load anything, as long as you provide the registration functions. Let's name it loadDynamicLibrary()
There was a problem hiding this comment.
nit: the titles are too long; maybe just add the docs as a refular numbered list?
There was a problem hiding this comment.
I pushed it out without the title formatting but does this look a bit cluttered now?
There was a problem hiding this comment.
can you use VELOX_ASSERT_THROW() instead to validate the right exception is being thrown?
There was a problem hiding this comment.
please vendor the macro. Maybe something like VELOX_TEST_DYNAMIC_LIBRARY_PATH
789da39 to
c5cbea2
Compare
c5cbea2 to
f8afbc0
Compare
There was a problem hiding this comment.
please use the GTest:: targets
There was a problem hiding this comment.
Please use target_compile_definitions( on the relevant target instead.
There was a problem hiding this comment.
| velox_add_library(velox_dynamic_function_loader DynamicLibraryLoader.cpp) | |
| velox_add_library(velox_dynamic_function_loader DynamicLibraryLoader.cpp) | |
| velox_link_libraries(velox_dynamic_function_loader PRIVATE velox_exception) |
There was a problem hiding this comment.
Thanks @soumiiow. Had bunch of minor comments, except for a bigger one around testing.
There was a problem hiding this comment.
Nit : rename registryFunction
There was a problem hiding this comment.
hey!! so i got some previous feedback to stay away from the "registryFunction" in the naming so as to not make it seem like this library is to be used exclusively for functions, and to move away from our initial design which was made with only the function loading in mind. Perhaps, would there be a better name for this variable than the work "item"? I can only rlly think of registryItem or registryPtr but would love to hear your suggestions too
There was a problem hiding this comment.
@soumiiow : To me this is almost like the "main" function in a executable program. How about "loadLibrary" or "loadUserLibrary" or "enterUserLibrary" ? There could be code beyond registration here as well.
There was a problem hiding this comment.
Add a comment "Invoke the registry function"
There was a problem hiding this comment.
This is not relevant in Velox. And also since its not used anywhere in the current code, its hard to put this in picture.
There was a problem hiding this comment.
It might be good to not talk about Prestissimo in this README.
This is a generic utility for dynamically loading a "registry" function from a library. Its sufficient to just say that this is for "Extensibility" features that add custom user code which could include new Velox types, functions, operators and connectors.
45cf7af to
4e82b71
Compare
4e82b71 to
ae2ad2e
Compare
b6660ad to
eb20996
Compare
aditi-pandit
left a comment
There was a problem hiding this comment.
@soumiiow : Thanks for updating your tests. Have a bunch of questions.
e06974a to
3bbd8db
Compare
pedroerp
left a comment
There was a problem hiding this comment.
That's awesome. Thanks for adding support for this.
Made a few small comments, but overall it looks good to me. Feel free to tag "ready-to-merge" when they are addressed and I'll get it merged.
There was a problem hiding this comment.
nit: remove this extra line
There was a problem hiding this comment.
LOG(INFO) << "Loaded library " << fileName << ". Searching registry symbol " << kSymbolName;
There was a problem hiding this comment.
do we also need to check if loadUserLibrary is nullptr?
There was a problem hiding this comment.
Added, as well as a short comment explaining how it can be nullptr but we can't actually use it when its nullptr.
There was a problem hiding this comment.
Can we also clarify that this only works if the builds are guaranteed to be based on the same Velox version and hence maintain ABI compatibility? This might not be immediate clear to users.
2dbe57e to
2ccbceb
Compare
|
CI is green. @pedroerp can you please help import and merge? Thank you. |
…uccessful mac & linux compilation Co-authored-by: mohsaka <michael.ohsaka@ibm.com>
|
@pedroerp has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@pedroerp the facebook builds&tools failed with a warning and the linter also reported a testing failure. Is this something that needs to be addressed in this PR? Thanks! |
@czentgr It's been fixed on the Meta side already. The README needed a newline at the end of the file. If we need the change here, I can make it. But I believe they merge over there and close the PR here, merging back to main here. I don't want to trigger a full pipeline rerun due to this. |
Allow users to dynamically register Velox components. Clients such as Presto can use this feature to dynamically load User Defined Functions, connectors, and types.
Based off: https://github.com/facebookincubator/velox/pull/1005/files