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

Moving away from Integer | Nothing to Rows_To_Read for limiting number of rows. #9925

Merged
merged 10 commits into from May 14, 2024

Conversation

jdunkerley
Copy link
Member

@jdunkerley jdunkerley commented May 11, 2024

Pull Request Description

  • Added a new Rows_To_Read type with conversions from Nothing and integers.
  • Updated read on Table, Column, DB_Table and DB_Column.
  • Updated Delimited_Format.Delimited to use Rows_To_Read for row_limit.
  • Updated Excel_Format.Sheet and Excel_Format.Range to use Rows_To_Read for row_limit.
  • Updated Excel_Workbook.read to use Rows_To_Read.
  • Updated Connection.read (in all connection types) to use Rows_To_Read.

image

image

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.

@jdunkerley jdunkerley added the CI: No changelog needed Do not require a changelog entry for this PR. label May 13, 2024
@jdunkerley jdunkerley marked this pull request as ready for review May 13, 2024 17:21
_ -> input

## PRIVATE
Rows_To_Read.from (that:Nothing) =
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these here only to handle existing code that uses the old interface?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep exactly. Any old limits will then be ok. Though not if the warning flag was set.

Co-authored-by: Radosław Waśko <radoslaw.wasko@enso.org>
Comment on lines -2147 to +2146
read self (max_rows : Nothing | Integer = Nothing) (warn_if_more_rows:Boolean = True) =
@max_rows Rows_To_Read.default_widget
read : Rows_To_Read -> Column
read self (max_rows : Rows_To_Read = ..All_Rows) =
Copy link
Member

Choose a reason for hiding this comment

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

This ..All_Rows looks so much clearer than Nothing. I'm really happy with our switching towards more meaningful arguments. And with autoscoping it is still quite terse :)

Comment on lines +39 to +44
## PRIVATE
attach_warning self input:Table -> Table = case self of
Rows_To_Read.First_With_Warning rows -> if input.row_count <= rows then input else
Problem_Behavior.Report_Warning.attach_problem_after (input.take (First rows)) <|
Not_All_Rows_Downloaded.Warning rows
_ -> input
Copy link
Member

Choose a reason for hiding this comment

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

Nice that this is now in a single place, makes the usages much clearer

Copy link
Member

@radeusgd radeusgd left a comment

Choose a reason for hiding this comment

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

Awesome

@jdunkerley jdunkerley added the CI: Ready to merge This PR is eligible for automatic merge label May 14, 2024
@mergify mergify bot merged commit b2aeb9f into develop May 14, 2024
37 checks passed
@mergify mergify bot deleted the wip/jd/read-redesign branch May 14, 2024 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants