-
Notifications
You must be signed in to change notification settings - Fork 85
feat: DH-19045: FilterBarriers and FilterRespectsBarriers #6885
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
base: main
Are you sure you want to change the base?
Conversation
engine/table/src/main/java/io/deephaven/engine/table/impl/AbstractFilterExecution.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/AbstractFilterExecution.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/AbstractFilterExecution.java
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/DeferredViewTable.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/QueryTable.java
Outdated
Show resolved
Hide resolved
table-api/src/main/java/io/deephaven/api/ConcurrencyControl.java
Outdated
Show resolved
Hide resolved
table-api/src/main/java/io/deephaven/api/ConcurrencyControl.java
Outdated
Show resolved
Hide resolved
table-api/src/main/java/io/deephaven/api/filter/ExtractAnds.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/AbstractFilterExecution.java
Show resolved
Hide resolved
|
||
@Override | ||
public WhereFilter visit(WhereFilterInvertedImpl filter) { | ||
return null; |
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.
The visit pattern here where we are not descending isn't perfectly clear. It seems like we should be able to descending for these and the conjunctive/disjunctive. Either way, I think Serial is deserving of a comment explaining why it is null and not descending.
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.
Are we changing DVT behavior? We've never tried to bubble up components from conj/disj. In the context of MatchFilters shouldn't the invert just get pushed into the match? The match allows for a variety of comparators. I'd have to poke around more w.r.t. ConditionFilter, but I believe current main would push a not(condition) into the post view set.
Agreed, I can add a serial comment; it is because of the goal to promise the rowset it sees pass all and only previous filters.
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 thinking of it more in terms of what the intention is. The intention is to allow MatchFilter and others to rename. I think the set of renaming filters is quite limited; but the Visitor could allow us to do better. It is a bit of scope creep, so we can defer it - but I do think we should point out what is necessary for function vs. what we don't care about because DVT is (IMO - but not others) an unnecessary complexity.
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.
It was relatively easy to add; will need to add unit test coverage.
engine/table/src/main/java/io/deephaven/engine/table/impl/select/WhereFilterInvertedImpl.java
Show resolved
Hide resolved
table-api/src/main/java/io/deephaven/api/filter/ExtractAnds.java
Outdated
Show resolved
Hide resolved
* a {@link FilterRespectsBarrier}, {@link FilterRespectsBarrier#respectedBarriers()} will be included in the returned | ||
* collection. Otherwise, an empty collection will be returned. | ||
*/ | ||
public enum ExtractRespectedBarriers |
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.
Does an abstract base class between these two make sense? The only real difference seems to be the four visit methods (FilterBarrier, RespectsBarrier) * (Filter, WhereFilter); but all the structural ones could be shared.
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 totally sure. Sharing an impl feels potentially an anti-pattern. I've now changed all of these callers to invoke the static of
method, which tries to make the null
return value (for unsupported WhereFilters) for a null list. I also separated visit
and visitWhereFilter
into distinct names which makes things a little more straightforward to follow. As a result, you can't just visit the inner filter, you have to go through the static helper.
Let's revisit your comment in our 1:1 tomorrow.
engine/table/src/main/java/io/deephaven/engine/table/impl/QueryTable.java
Outdated
Show resolved
Hide resolved
final Table result = sourceWithData.where( | ||
Filter.and( | ||
preFilter.withBarrier(barrier), | ||
RawString.of("A < 50000").respectsBarrier(barrier), | ||
postFilter)); |
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.
Add the case where we can move a little bit:
final Table result = sourceWithData.where( | |
Filter.and( | |
preFilter.withBarrier(barrier), | |
RawString.of("A < 50000").respectsBarrier(barrier), | |
postFilter)); | |
final Table result = sourceWithData.where( | |
Filter.and( | |
preFilter.withBarrier(barrier), | |
RawString.of("A < 50000").respectsBarrier(barrier), | |
postFilter)); | |
final Table result2 = sourceWithData.where( | |
Filter.and( | |
preFilter.withBarrier(barrier), | |
preFilter2, | |
RawString.of("A < 50000").respectsBarrier(barrier), | |
)); |
Ideally in this case, we can move the "A" filter before preFilter2; though practically that might not work.
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.
For Enterprise ACLs we're going to have something like:
SourceTable.where(Filter.or("Group=Asdf
", "GroupType=DEF
))
then the user will do:
x=new HashSet<>()
.where("Date=today()", "x.add(Group)")
We need to make sure that these filters are correctly applied.
One way to think about that is that the deferred ACL table could say:
FilterBarrier.of(Filter.or("Group=Asdf
", "GroupType=DEF
), "ACL")
FilterRespectsBarrier("x.add(Group)", "ABC") // based on the isSimpleFilter tagging filters that can execute user code
This does not yet include any unit tests but is otherwise what I believe should be the rough end-to-end impl server side for filter barriers.
not ready until / still missing: