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

fix(literal): allow creating ibis literal with uuid #3131

Merged
merged 5 commits into from
Nov 22, 2021

Conversation

gforsyth
Copy link
Member

@gforsyth gforsyth commented Nov 22, 2021

import ibis
import uuid

value = uuid.uuid4()
x = ibis.literal(value, type="uuid")

This was raising

IbisTypeError: argument passes none of the following rules: instance_of((<class 'shapely.geometry.base.BaseGeometry'>, <class 'bytes'>, <class 'datetime.date'>, <class 'datetime.datetime'>, <class 'datetime.time'>, <class 'datetime.timedelta'>, <class 'dict'>, <enum 'Enum'>, <class 'float'>, <class 'frozenset'>, <class 'int'>, <class 'list'>, <class 'numpy.generic'>, <class 'numpy.ndarray'>, <class 'pandas._libs.tslibs.timedeltas.Timedelta'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'set'>, <class 'str'>, <class 'tuple'>, <class 'NoneType'>),), is_computable_input()

but ibis.literal(str(value), type="uuid") wasn't. Adding in uuid.UUID as a valid instance_of rule

Fixes #3130

gforsyth and others added 2 commits November 22, 2021 10:37
```
import ibis
import uuid

value = uuid.uuid4()
x = ibis.literal(value, type="uuid")
```
@gforsyth
Copy link
Member Author

Fixes #3130

@cpcloud cpcloud added the bug Incorrect behavior inside of ibis label Nov 22, 2021
@cpcloud
Copy link
Member

cpcloud commented Nov 22, 2021

@gforsyth I think you need to put the issue in the PR description otherwise GH won't pick it up for autoclosing.

@cpcloud cpcloud added the expressions Issues or PRs related to the expression API label Nov 22, 2021
@cpcloud cpcloud added this to the Next release milestone Nov 22, 2021
Copy link
Member

@cpcloud cpcloud left a comment

Choose a reason for hiding this comment

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

LGTM.

ibis/tests/expr/test_value_exprs.py Show resolved Hide resolved
@gforsyth
Copy link
Member Author

@gforsyth I think you need to put the issue in the PR description otherwise GH won't pick it up for autoclosing.

Yeah, I hadn't seen the issue when I opened it and I don't think github picks up the autoclose if it gets edited into the PR description after the fact. I'll add it in just for the sake of summarization

@gforsyth
Copy link
Member Author

gforsyth commented Nov 22, 2021

@gforsyth I think you need to put the issue in the PR description otherwise GH won't pick it up for autoclosing.

Yeah, I hadn't seen the issue when I opened it and I don't think github picks up the autoclose if it gets edited into the PR description after the fact. I'll add it in just for the sake of summarization

Oh good, I was wrong!

@pep8speaks
Copy link

pep8speaks commented Nov 22, 2021

Hello @gforsyth! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-11-22 15:57:13 UTC

```
import ibis
import uuid

value = uuid.uuid4()
x = ibis.literal(value, type="uuid")
```
@github-actions
Copy link
Contributor

github-actions bot commented Nov 22, 2021

Unit Test Results

         8 files           8 suites   15m 54s ⏱️
  2 860 tests   2 791 ✔️   69 💤 0
22 824 runs  22 272 ✔️ 552 💤 0

Results for commit b0f4f44.

♻️ This comment has been updated with latest results.

@cpcloud cpcloud merged commit b0f4f44 into ibis-project:master Nov 22, 2021
@gforsyth gforsyth deleted the uuid_literal branch November 22, 2021 17:45
@cpcloud cpcloud modified the milestones: Next release, 2.x Jan 7, 2022
@ibis-project-bot
Copy link
Contributor

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis expressions Issues or PRs related to the expression API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: uuid.UUID values are no longer accepted in ibis.literal
3 participants