-
Notifications
You must be signed in to change notification settings - Fork 0
Support protobuf serialization/deserialization for dynamic filters #7
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
Support protobuf serialization/deserialization for dynamic filters #7
Conversation
249b455 to
75e9a56
Compare
6e148d7 to
4cd7688
Compare
75e9a56 to
3a445e3
Compare
4cd7688 to
2b753fc
Compare
3a445e3 to
f722d32
Compare
…s as the second argument to "optimizer()"
2b753fc to
89154ca
Compare
| let config = config.unwrap_or_default(); | ||
| let config = config | ||
| .unwrap_or_default() | ||
| .with_extension(Arc::new(DynamicFiltersRegistry::default())); | ||
| let runtime_env = runtime_env.unwrap_or_else(|| Arc::new(RuntimeEnv::default())); |
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'm not sure this is the best way of propagating the DynamicFiltersRegistry, this looks more like the way I'd propagate my custom stuff in my custom project, so maybe there's a better way of propagating this in this repo. Any suggestions here are very appreciated.
…c values in a DynamicFiltersRegistry that lives globally to a DataFusion session
89154ca to
a9fd174
Compare
|
Out of curiosity, why creating a global (static) When Also, maybe some kind of week hash map would be better fit than dash map, but i'm not sure wdyt @gabotechs ? |
That could be an option, although I'd expect that to come with all the disadvantages that having global mutable state usually has in general:
|
|
I'm no longer going to work on this though, so it's safe to close this one. |
This PR need the following other PRs to be merged first:
Which issue does this PR close?
Rationale for this change
Currently, the producer and consumer ends of a
DynamicFilterPhysicalExprdepend on theirinnerpointers to be the same in order to properly communicate updates on the inner filter values:However, under certain situations, both producer and consumer parts of
DynamicFilterPhysicalExprwill not necessary share the same Arc pointer, like when theDynamicFilterPhysicalExprgets serialized from protobuf and then deserialized.This PR proposes an alternative way of storing the
Arc<RwLock<Inner>>inner values of a dynamic filters: aDynamicFilterRegistrystructure that lives globally to a DataFusion session, and that different instances of aDynamicFilterPhysicalExprin a plan can access through theSessionConfigusing a unique identifier.Allows serializing/deserializing dynamic filters from and to protobuf, while keeping the producer and consumer part of the dynamic filter connected.
Having a registry of dynamic filter values global to a session could allow us to subscribe to changes there in the future, so that they can be streamed and synced over the wire in a distributed query. A potential evolution for allowing this could be making
DynamicFilterRegistrya trait, very roughly something like this:That distributed systems could implement themselves.
What changes are included in this PR?
DynamicFilterRegistrystructure that holds dynamic filter values.DynamicFilterRegistryin theSessionConfigso that it's shared across any plan in the same session.Are these changes tested?
yes, by existing tests and a new test.
Are there any user-facing changes?
Users of the
datafusion-protopackage can now serialize/deserialize dynamic filters