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

Error messages for rename_columns and Vector.duplicates #9917

Merged
merged 5 commits into from
May 10, 2024

Conversation

jdunkerley
Copy link
Member

@jdunkerley jdunkerley commented May 10, 2024

Pull Request Description

  • Improve error message for rename_columns.
  • Add length to Set and Map.
  • Add duplicates to Vector (and Array).

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.

if map.size == mapping.length then rename_columns naming_helper internal_columns map case_sensitivity error_on_missing_columns on_problems else
duplicates = mapping.duplicates on=_.first . map .to_text
duplicate_text = duplicates.take 3 . to_vector . join ", " + (if duplicates.length > 3 then ", ..." + (duplicates.length - 3).to_text + " others" else "")
Error.throw (Illegal_Argument.Error "duplicate old name mappings ("+duplicate_text+").")
Copy link
Member

Choose a reason for hiding this comment

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

Can we add tests for this?

Copy link
Member

@AdRiley AdRiley 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! A much better error message for the end users :)

@jdunkerley jdunkerley added the CI: Ready to merge This PR is eligible for automatic merge label May 10, 2024
@mergify mergify bot merged commit d97754d into develop May 10, 2024
34 checks passed
@mergify mergify bot deleted the wip/jd/error-messages branch May 10, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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