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

Maxrec in regsearch #375

Merged
merged 4 commits into from
Oct 17, 2022
Merged

Maxrec in regsearch #375

merged 4 commits into from
Oct 17, 2022

Conversation

msdemlei
Copy link
Contributor

registry.regsearch now accepts an optional maxrec argument

This addresses bug #373. It may change results if people actually retrieved humungous amounts (by registry standards) of records (more than 20000 with the default server). I'd say: Whoever does this kind of thing deserves a heads-up that they should be doing it differently. Alternatively, they can pass in maxrec=10000000 manually.

The tables in resource.get_tables() come in random column order (because
they are fed from the results of relational database queries).  That's
arguably not ideal, but it is what we can do given what the registry
has in terms of metadata, and it actually doesn't hurt as long as people are
aware of it.

This commit changes an example in the documentation to become reproducible.
The example gets a bit uglier this way, but it's probably still on the
good side of making examples runnable rather than didactic (where the
two conflict, which they do in this case).
@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Merging #375 (c7cdc18) into main (80a807e) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #375      +/-   ##
==========================================
- Coverage   78.56%   78.55%   -0.02%     
==========================================
  Files          47       47              
  Lines        5562     5562              
==========================================
- Hits         4370     4369       -1     
- Misses       1192     1193       +1     
Impacted Files Coverage Δ
pyvo/registry/regtap.py 78.94% <100.00%> (ø)
pyvo/dal/tap.py 72.91% <0.00%> (-0.26%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -128,6 +131,12 @@ def search(*constraints:rtcons.Constraint, includeaux=False, **kwargs):
This may result in duplicate capabilities being returned,
especially if the servicetype is not specified.

maxrec : int
Overrides the RegTAP server's default limit on the number of rows to
return. You may need to use this if you want to retrieve more
Copy link
Contributor

@andamian andamian Oct 12, 2022

Choose a reason for hiding this comment

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

This is a bit confusing. The DALI standard states that The service may also enforce a limit on the value of MAXREC that is smaller than the value in the request. so I don't think one can use this to override server's MAXREC unless the requested value is smaller than the server's limit. So in general, requested MAXREC is to limit the number of rows and not to expand.

@bsipocz bsipocz added this to the v1.5 milestone Oct 12, 2022
@msdemlei
Copy link
Contributor Author

msdemlei commented Oct 13, 2022 via email

Comment on lines 135 to 138
Overrides the RegTAP server's default limit on the number of rows to
return. You may need to use this if you want to retrieve more
than a few thousand matches. Note that truncated search results
are not reproducible.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Overrides the RegTAP server's default limit on the number of rows to
return. You may need to use this if you want to retrieve more
than a few thousand matches. Note that truncated search results
are not reproducible.
Overrides the RegTAP server's default limit on the number of rows to
return. You may need to use this if you want to retrieve more
than a few thousand matches.
The server may also have a hard limit that ``maxrec`` cannot override.
Please note that truncated search results are not reproducible.

Copy link
Contributor

Choose a reason for hiding this comment

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

My reading of the spec is that the server has the last word and might override the requested MAXREC as I highlighted in my comment. The rest looks OK so I'll also approve it to fix the doctest.

@bsipocz
Copy link
Member

bsipocz commented Oct 16, 2022

main currently has a doctest failure affecting all other PRs, and this has a fix for it, so it would be nice to get this merged sooner rather than later. I've added one more sentence to the docstring to cover your third point that I feel wasn't conveyed before.

Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

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

Approving so we can go ahead and merge this. Please either add my suggestion or a similar sentence that clears up the hard limit override scenario (I don't feel strongly about how you phrase it, but agree with the review that it's not coming through from the original text).

@msdemlei
Copy link
Contributor Author

msdemlei commented Oct 17, 2022 via email

@bsipocz
Copy link
Member

bsipocz commented Oct 17, 2022

OK, I'm going ahead with the merge and rebasing the other PRs.

Thanks @msdemlei! As for explaining the maxrec situation in the narrative docs, it all sounds good, but I strongly think that it should be repeated in each and every docstring, too.

@bsipocz bsipocz merged commit d1acb30 into astropy:main Oct 17, 2022
@tomdonaldson
Copy link
Contributor

Thanks @msdemlei for this more complete approach to addressing #373! I've closed my alternate lazy approach (#374).

@bsipocz
Copy link
Member

bsipocz commented Dec 22, 2022

I would say this is fixing a bug (#389), so if we do a bugfix 1.4.1, it can be shipped with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants