Added parquet support for filters parameter#1308
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1308 +/- ##
==========================================
- Coverage 89.48% 89.46% -0.03%
==========================================
Files 367 367
Lines 49852 49867 +15
Branches 5855 5863 +8
==========================================
+ Hits 44611 44614 +3
- Misses 3853 3864 +11
- Partials 1388 1389 +1 ☔ View full report in Codecov by Harness. |
32dee77 to
c805ef4
Compare
92678f6 to
c09907e
Compare
c09907e to
1280ff0
Compare
| if col not in schema.names: | ||
| raise ValueError( | ||
| f"Column {col} specified in filters not available in parquet file." | ||
| ) |
There was a problem hiding this comment.
Is the indentation correct above? This won't do the check if it is an Expression; is that intended?
There was a problem hiding this comment.
It is not, I should fix it to perform the check if it is an Expression as well.
| if all(isinstance(item, tuple) for item in par_filters): | ||
| par_filters = [par_filters] # convert to DNF for column checking | ||
| elif not all(isinstance(item, list) for item in par_filters): | ||
| raise TypeError("List filters must contain tuples or lists of tuples.") |
There was a problem hiding this comment.
I don't understand this section at all. If it's a list of tuples you convert a list to a list of lists? And then if it's a list of lists it raises?
There was a problem hiding this comment.
I converted the list of tuples to a list of list of tuples for streamlined column checking later on (par_filters in DNF). It should only raise the TypeError if it is not a list of tuples or list of lists.
| # but Ctrl+f "ValueErrorWeirdness2" below. | ||
| # with self.assertRaises(ValueError): | ||
| # self.butler.get(self.datasetType, dataId={}, | ||
| # parameters={"filters": [("e", ">", 1)]}) |
There was a problem hiding this comment.
Tests of the functionality is missing.
There was a problem hiding this comment.
Yes, this is addressed in the third bullet points of the notes above. I couldn't figure out why it raises a ValueError outside of the context manager, but calling the context manager to check for a ValueError raises an AssertionError.
|
After revisiting Eli's feedback and doing some more research, I think implementing parquet filter support is probably above my pay grade:
Passing filters without any field checks to |
Checklist
doc/changesconfigs/old_dimensionsNotes
exceptblock preventing theValueErrorfor invalid columns in the filter predicates from being interpreted directly. See the #FIXME comments intest_parquet.py. Thegetcall outside theassertRaisescontext manager DOES raise aValueError, but thegetcall inside theassertRaisescontext manager raises anAssertionErrorfor not raising a value error.