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

feat: provide a way for Form.select_columns to distinguish structural dots from dots in the names of record fields #3222

Conversation

tcawlfield
Copy link
Collaborator

Addressing the need to select field names with literal dots in them.

This is a change to Form.select_columns(). This change allows a user to supply a specifier as a list of lists of field (or column) names.

Actually, allowing a list of lists of str in case a literal "." appears as a record name.
@tcawlfield tcawlfield self-assigned this Aug 21, 2024
@jpivarski jpivarski changed the title 3088 formselect columns needs a way to distinguish structural dots from dots in the names of record fields feat: provide a way for Form.select_columns to distinguish structural dots from dots in the names of record fields Aug 22, 2024
Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

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

This looks great!

The one error doesn't seem to be related to this, and it's persistent enough to survive re-running the worker. (It looked to me like an installation/packaging issue, so that's why I tried re-running.)

E       AssertionError: Regex pattern did not match.
E        Regex: "Can't pickle"
E        Input: "Can't get local object 'test_serialise_with_nonserialisable_attrs.<locals>.<lambda>'"

The second error message does seem to be related to not being able to pickle; lambda functions generally aren't pickleable. But somehow the "Can't pickle" message isn't there.

…nguish-structural-dots-from-dots-in-the-names-of-record-fields
tcawlfield and others added 2 commits August 28, 2024 14:20
Added a new test for from_parquet.
Added some documentation to from_parquet.
Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

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

Selecting everything that matches, when there's ambiguity, is a good choice.

Thanks for the detailed docstring on column selector syntax!

I just have a few comments on the error messages themselves, and broadening the argument to accept any iterable, not just lists and tuples. (It's not unusual for a Python user to not even know the exact type of collection they're using, just that it's a collection. For instance, it could be an array, a set, an iterator from some_dict.values() (which is not a list), etc.)

src/awkward/forms/form.py Outdated Show resolved Hide resolved
src/awkward/forms/form.py Outdated Show resolved Hide resolved
src/awkward/forms/form.py Outdated Show resolved Hide resolved
src/awkward/forms/form.py Outdated Show resolved Hide resolved
src/awkward/operations/ak_from_parquet.py Outdated Show resolved Hide resolved
…nguish-structural-dots-from-dots-in-the-names-of-record-fields
@jpivarski
Copy link
Member

Also, I've updated the branch, so be sure to git pull if you're editing a local copy (instead of just patching in small fixes through the web interface).

Also correcting some documentation and exception text.
@tcawlfield tcawlfield merged commit 09351fc into main Aug 29, 2024
41 checks passed
@tcawlfield tcawlfield deleted the 3088-formselect_columns-needs-a-way-to-distinguish-structural-dots-from-dots-in-the-names-of-record-fields branch August 29, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Form.select_columns needs a way to distinguish structural dots from dots in the names of record fields
2 participants