-
Notifications
You must be signed in to change notification settings - Fork 609
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: upcast dtype on union of two schemas #5707
Comments
How about a |
I think that makes sense to have it separate. Would the order matter?
PErhaps just a different name from upcast? |
We already have code to upcast types, and that code isn't order dependent. |
OK, sounds good. Is this the behavior that you are thinking of, where it acts like a union if a column is only present in one input schema: def upcast(self, other):
all_columns = set(self.names) | set(other.names)
d = {}
uncastables = []
for c in all_columns:
if c not in self:
d[c] = other[c]
elif c not in other:
d[c] = self[c]
else:
try:
d[c] = self[c].upcast(other[c])
except CastError:
uncastables.append(c)
if uncastables:
raise CastError("some columns aren't compatible: ", uncastables)
return Schema(d) |
@NickCrews Does this
|
hmm, not quite, because the result will have exactly I think it might be best if we just exposed a public |
I think we should overhaul this part of the codebase a bit and instead of checking for castability, we have a |
@cpcloud I agree, I think I had this same proposal in #7331 (comment) |
I believe the existing |
Is your feature request related to a problem?
If I have two schemas that are the same, except the dtype of column X in is int32 vs int64, then if I union these two schemas I get an error.
Really, I would like to get a schema with X of type int64, the upcasted version of those two dtypes.
Describe the solution you'd like
As I say above.
Behavior is still poorly defined for
&
and-
operators, so I would still say error there.What version of ibis are you running?
head
What backend(s) are you using, if any?
all
Code of Conduct
The text was updated successfully, but these errors were encountered: