-
Notifications
You must be signed in to change notification settings - Fork 603
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(api): move from .case() to .cases() #9039
Conversation
9eedc15
to
d8be23f
Compare
6b3dc20
to
7f4c570
Compare
371c2bc
to
d8ea163
Compare
OK I think this is ready for review! I can break this into smaller commits if you want, I think I now have all the semantics figured out how I like them. |
6ca584a
to
2bc9121
Compare
Can you keep around a test case the deprecated builder API? |
@kszucs I re-added some simple tests how does that look? I can add the tests for all the edge cases, but I would prefer not to. More of the actual functionality (eg datashape and datatype logic) now happens inside the Operation, which both APIs share, so both APIs should be fairly aligned |
d597e37
to
bc9012e
Compare
pyspark is issuing some ResourceWarning for some unrelated reason, is this some separate bug we should address? |
oops, just discovered this is breaking for existing users of Value.cases(). Need to add some compat code in there. ugggh it's gonna be annoying. |
This is setup for #9039, where I change the API of Value.cases(), so I want to make sure that this functionality doesn't change, but the user gets a deprecationwarning
bc9012e
to
aef2e0f
Compare
OK, probably the most complex thing I do here is the arg, kwarg normalization to maintain compatibility with the old API. I feel pretty good about the way I did it, but I would love some red teaming to try to figure out if there are flaws with it. |
aef2e0f
to
46c962e
Compare
This is setup for #9039, where I change the API of Value.cases(), so I want to make sure that this functionality doesn't change, but the user gets a deprecationwarning
46c962e
to
322233b
Compare
Is it a bug that impala is returning a nan instead of None? It sure is annoying to have to do if exp is None:
assert pd.isna(result)
else:
assert result == exp just for impala |
It looks like you've branched into |
I think this is too close to the release to get it in for 9.0. We'll probably need to do another non-major release a week or two afterward, so let's get it in first thing after we release 9. |
This is setup for ibis-project#9039, where I change the API of Value.cases(), so I want to make sure that this functionality doesn't change, but the user gets a deprecationwarning
Closing in in favor of #9096 (which is correctly coming from my fork) |
Pull request was closed
This is setup for ibis-project#9039, where I change the API of Value.cases(), so I want to make sure that this functionality doesn't change, but the user gets a deprecationwarning
This is setup for ibis-project#9039, where I change the API of Value.cases(), so I want to make sure that this functionality doesn't change, but the user gets a deprecationwarning
This is setup for ibis-project#9039, where I change the API of Value.cases(), so I want to make sure that this functionality doesn't change, but the user gets a deprecationwarning
WIP. Redo of #7914 on top of the modern code. Changes from that PR:
CASE x WHEN 5 THEN ...
x.cases((x==5, 3))
was allowed. Now it is disallowed, it's too clever. If you want to do that, it's an easy transition to use the top-levelibis.cases()
ibis.null().cases((None, "fill"), else_="not hit")
always results in "not hit". Maybe not the best ergonomics, but at least it is consistent and written down. Perhaps we can revisit later.ibis.cases(("not a bool", "someval"))
. I think we should fix that upstream in the ops.Literal constructor.base
orcases
. Really it needs to depend on ALL inputs.ibis.cases()
(results in NULL) andibis.cases(else_=5)
(results in 5). I considered disallowing these, but I don't think there is anything semantiically wrong with supporting this.TODOs that I found that should come in followups:
val.substitute({None: 4})
currently does a fillna(). But if you doval.cases((None, 4), else_=val)
, then this ALWAYS hits the else_ case, becausex = NULL
never evals to True. This also isn't even consistent in the sense that it only special cases for pythonNone
. If you doibis.null()
, or something only known at runtime likeibis.literal(5).nullif(5)
, then this will always hit the else_ case. Due to these limitations, I vote for making matching against NULLs out of scope for .cases and .substitute. If a user wants to do this, then they better do a .fillna() before.