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

First letter grouping #1314

Merged
merged 8 commits into from
May 4, 2022
Merged

First letter grouping #1314

merged 8 commits into from
May 4, 2022

Conversation

mathemancer
Copy link
Contributor

Fixes #408

This adds a grouping mode to the API which allows one to group by the first n characters of each entry in a column (after casting to TEXT if needed).

Technical details

n is given by the prefix_length parameter. Only works on single columns. In particular, this sorts out #408 for textual columns by giving "prefix_length": 1.

Also adds all GroupBy object properties to the returned grouping JSON object.

NOTE: This should be merged after #1312 .

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the master branch of the repository
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@mathemancer
Copy link
Contributor Author

This can be reviewed and merged as soon as #1312 is merged. Leaving as a draft until that point to avoid mistakes.

@codecov-commenter
Copy link

codecov-commenter commented Apr 26, 2022

Codecov Report

Merging #1314 (ee686e1) into master (e2fedad) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1314      +/-   ##
==========================================
+ Coverage   93.49%   93.58%   +0.09%     
==========================================
  Files         114      114              
  Lines        4426     4491      +65     
==========================================
+ Hits         4138     4203      +65     
  Misses        288      288              
Flag Coverage Δ
pytest-backend 93.58% <100.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mathesar/api/pagination.py 78.57% <ø> (ø)
db/records/operations/group.py 98.98% <100.00%> (+0.49%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2fedad...ee686e1. Read the comment docs.

@dmos62 dmos62 self-assigned this May 4, 2022
@dmos62 dmos62 marked this pull request as ready for review May 4, 2022 12:25
@dmos62 dmos62 requested review from a team and silentninja and removed request for a team May 4, 2022 12:25
@dmos62 dmos62 enabled auto-merge May 4, 2022 12:28
@kgodey kgodey requested review from dmos62 and removed request for silentninja May 4, 2022 13:09
@dmos62 dmos62 merged commit c00598a into master May 4, 2022
@dmos62 dmos62 deleted the first_letter_grouping branch May 4, 2022 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Implement grouping for Text types.
4 participants