Skip to content

Commit

Permalink
Fix overzealous dooming in queryDatasets.
Browse files Browse the repository at this point in the history
Unlike queryDataIds and queryDimensionRecords, one missing dataset type
here should not doom the entire query.
  • Loading branch information
TallJimbo committed Oct 4, 2022
1 parent 8a42d8f commit e94e76b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/registries/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ def queryDatasets(
check=check,
datasets=[parent_dataset_type],
)
builder = self._makeQueryBuilder(summary, doomed_by=doomed_by)
builder = self._makeQueryBuilder(summary)
# Add the dataset subquery to the query, telling the QueryBuilder
# to include the rank of the selected collection in the results
# only if we need to findFirst. Note that if any of the
Expand Down
10 changes: 10 additions & 0 deletions python/lsst/daf/butler/registry/tests/_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2666,6 +2666,16 @@ def testQueryResultSummaries(self):
self.assertEqual(query5.count(exact=True), 0)
messages = list(query5.explain_no_results())
self.assertFalse(messages)
# This query should yield results from one dataset type but not the
# other, which is not registered.
query5 = registry.queryDatasets(["bias", "nonexistent"], collections=["biases"])
self.assertTrue(set(query5))
self.assertTrue(query5.any(execute=False, exact=False))
self.assertTrue(query5.any(execute=True, exact=False))
self.assertTrue(query5.any(execute=True, exact=True))
self.assertGreaterEqual(query5.count(exact=False), 1)
self.assertGreaterEqual(query5.count(exact=True), 1)
self.assertFalse(messages, list(query5.explain_no_results()))

def testQueryDataIdsOrderBy(self):
"""Test order_by and limit on result returned by queryDataIds()."""
Expand Down

0 comments on commit e94e76b

Please sign in to comment.