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

Enable casting PyObject's to primitives; provide type param info for py lists #1490

Merged
merged 14 commits into from
Nov 3, 2021

Conversation

nbauernfeind
Copy link
Member

@nbauernfeind nbauernfeind commented Oct 27, 2021

Also did this for String/boolean/Boolean:

from deephaven import TableTools
x = ['0', '1', '42', None]
y = TableTools.emptyTable(1).update("X = (String)x[i % x.size()]")
print(y.getDefinition())

Note that after some discussion we preferred to NPE when casting to boolean and the value is a None. We also decided that a String cast should throw an exception if not already a String (instead of converting via PyObject::str).

Fixes #1009

Copy link
Member

@rcaudy rcaudy left a comment

Choose a reason for hiding this comment

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

Good change overall. Needs more testing, and maybe some cleanup in Param.

@nbauernfeind nbauernfeind force-pushed the pyobject_primitive_cast branch 2 times, most recently from 81c8134 to 03836c3 Compare November 1, 2021 23:06
rcaudy
rcaudy previously approved these changes Nov 2, 2021
@nbauernfeind nbauernfeind modified the milestones: Oct 2021, Nov 2021 Nov 2, 2021
Co-authored-by: Chip Kent <5250374+chipkent@users.noreply.github.com>
chipkent
chipkent previously approved these changes Nov 2, 2021
@nbauernfeind nbauernfeind merged commit 9e60ab4 into deephaven:main Nov 3, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ClassCastException when casting a value retrieved from a Python list
4 participants