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

[ENH] Fix for record pagination #1450

Merged
merged 17 commits into from
Dec 12, 2023
Merged

[ENH] Fix for record pagination #1450

merged 17 commits into from
Dec 12, 2023

Conversation

jeffchuber
Copy link
Contributor

@jeffchuber jeffchuber commented Dec 1, 2023

This fixes the pagination on records. Before we would select all data, and then subsample - this obviously is not very performant and this fixes it. credit to @HammadB

  • Fix bug with limit first
  • add tests

Copy link

github-actions bot commented Dec 1, 2023

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readbility, Modularity, Intuitiveness)

@jeffchuber jeffchuber changed the title Fix/pagination Fix for record pagination Dec 1, 2023
@jeffchuber jeffchuber changed the base branch from main to feat/tenant-db-support-js December 1, 2023 20:56
@HammadB
Copy link
Collaborator

HammadB commented Dec 4, 2023

I'd like us to add a property test that applies valid limits/offsets and does a model check.

I also think we ought to test the tail cases - what happens if limit is negative, offset is beyond size etc.

@HammadB HammadB changed the title Fix for record pagination [ENH] Fix for record pagination Dec 4, 2023
@jeffchuber
Copy link
Contributor Author

jeffchuber commented Dec 5, 2023

def test_filterable_metadata_get(

@given(
    collection=collection_st,
    record_set=recordset_st,
)

generate random limit and offset (eg like dimension = draw(st.integers(min_value=2, max_value=2048)))

expected_ids truncate.

what happens if you limit negative
what happens if you offset more than number of records in collection- return no results

@jeffchuber
Copy link
Contributor Author

jeffchuber commented Dec 8, 2023

this is ready to merge - pending review

Base automatically changed from feat/tenant-db-support-js to main December 8, 2023 21:59
res = segment.get_metadata(limit=3)
assert len(res) == 3

# if limit is negative, return all results
Copy link
Collaborator

@HammadB HammadB Dec 8, 2023

Choose a reason for hiding this comment

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

We don't want to just error? I think being explicit would be nice here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ive made this change

@@ -43,7 +43,7 @@
"scripts": {
"test": "run-s db:clean db:cleanauth db:run test:runfull db:clean test:runfull-authonly db:cleanauth",
"testnoauth": "run-s db:clean db:run test:runfull db:clean",
"testauth": "run-s db:cleanauth db:run-auth test:runfull-authonly db:cleanauth",
"testauth": "run-s db:cleanauth test:runfull-authonly db:cleanauth",
Copy link
Collaborator

Choose a reason for hiding this comment

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

For me - why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was made upstream

@@ -0,0 +1,272 @@
import { Configuration, ApiApi as DefaultApi } from "./generated";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this part of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was made upstream

Copy link
Collaborator

@HammadB HammadB left a comment

Choose a reason for hiding this comment

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

I am a bit confused why the JS client changes are so large in scope, but this overall looks good to me minus some questions.

@jeffchuber
Copy link
Contributor Author

This diff got really messed up somehow - will fix and then have you re-review.

@jeffchuber
Copy link
Contributor Author

@HammadB ok this is fixed up now, sorry about the weird diff, main moved underneath me and github got out of sync

Copy link
Collaborator

@HammadB HammadB left a comment

Choose a reason for hiding this comment

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

Looks great thanks

@jeffchuber jeffchuber merged commit 16d3fe9 into main Dec 12, 2023
94 checks passed
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.

None yet

2 participants