Skip to content
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

DM-45933: new query system changes prompted by integration with QG generation #1071

Merged
merged 15 commits into from
Sep 10, 2024

Conversation

TallJimbo
Copy link
Member

@TallJimbo TallJimbo commented Sep 6, 2024

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes
  • (if changing dimensions.yaml) make a copy of dimensions.yaml in configs/old_dimensions

Copy link

codecov bot commented Sep 6, 2024

Codecov Report

Attention: Patch coverage is 91.39344% with 21 lines in your changes missing coverage. Please review.

Project coverage is 89.65%. Comparing base (cca901d) to head (8b11755).
Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
python/lsst/daf/butler/queries/_query.py 62.85% 7 Missing and 6 partials ⚠️
...t/daf/butler/direct_query_driver/_query_builder.py 0.00% 1 Missing and 1 partial ⚠️
...thon/lsst/daf/butler/queries/expression_factory.py 33.33% 2 Missing ⚠️
python/lsst/daf/butler/dimensions/_database.py 87.50% 1 Missing ⚠️
python/lsst/daf/butler/dimensions/_skypix.py 90.90% 1 Missing ⚠️
python/lsst/daf/butler/queries/overlaps.py 97.77% 1 Missing ⚠️
...lsst/daf/butler/queries/tree/_column_expression.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1071      +/-   ##
==========================================
+ Coverage   89.64%   89.65%   +0.01%     
==========================================
  Files         359      359              
  Lines       46727    46885     +158     
  Branches     9609     9637      +28     
==========================================
+ Hits        41888    42036     +148     
- Misses       3478     3482       +4     
- Partials     1361     1367       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@dhirving dhirving left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

from ..queries.tree import DimensionFieldReference

return DimensionFieldReference(
element=cast(DimensionElement, endpoint),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be safer to narrow the type with an assert instead of casting.

record.definition, db_rows.overlap_insert_rows, overlap_delete_rows=[]
record.definition,
db_rows.overlap_insert_rows,
overlap_delete_rows=[],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few of these files seem to have a bunch of places where unchanged code was randomly reformatted... not sure if there is a mismatched black version in play or what.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I did have a misconfigured editor early on in my work on this branch and I had thought I fixed all of the fallout, but it seems I did miss some.

@TallJimbo TallJimbo force-pushed the tickets/DM-45933 branch 3 times, most recently from 5adaf49 to befce85 Compare September 9, 2024 15:47
This is a complex query pattern that's very important for QG
generation, so it's very useful to have a targeted test in daf_butler.
Dimensions are now expanded to include those referenced by dataset
types and correctly expanded to include those referenced by
dimension fields (the keys of 'dimension_fields' can be elements like
'visit_detector_region' that aren't dimensions).

'dimensions' can now be an iterable of str, as in other query methods.

'find_first' no longer defaults to False, since it defaults to True in
other query methods.  But we can't actually support find_first=True in
some general-query (though we might be able to in the future).  So now
it's required if there are any dataset fields in the results, even if
sometimes you have no choice but to pass `False`; it makes what you're
getting explicit rather than possible hard to infer.

The special '...' value for dataset_fields now means 'all fields
needed to make a DatasetRef', not 'all possible dataset fields'.
It turns out we really only ever want to pass the dimensions of a query
here, even when the TopologicalFamily doesn't represent dimensions
(a problem that is so far hypothetical, but won't be an later commits
to this branch).
This will save us from some isinstance/match checks down the road.
This requires reordering some of the query planning logic so we can
get a list of calibration dataset types to the overlap-resolution
logic.
We want to raise when somebody says "visit = 42" as a query constraint
without also specifying the instrument that makes that visit ID
meaningful.  But a multi-instrument "visit.region OVERLAPS {region}"
query (for example) should be perfectly fine.
@TallJimbo TallJimbo merged commit 1d1bf7b into main Sep 10, 2024
18 checks passed
@TallJimbo TallJimbo deleted the tickets/DM-45933 branch September 10, 2024 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants