GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — fix: keep NaN distinct from NULL in float columns when pandas is enabled by maharanay22 · Pull Request #979 · databricks/databricks-sql-python ConversationWhat type of PR is this?
DescriptionFixes #978. With pandas enabled (the default), After the object array is built, NaN is set back on the cells that are NaN in the Arrow column, using a vectorized This is a user-visible change: code that treated a NaN result as How is this tested?
New tests in Related Tickets & DocumentsFixes #978. Related: #960 edits the same function for nested types. This change sits right after
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
3 tasks done
maharanay22
force-pushed
the
fix-nan-float-null-conversion
branch
2 times, most recently
from
d836dcb to
2057880
Compare
With pandas enabled (the default), _convert_arrow_table maps float32 and
float64 columns to pandas' nullable Float32Dtype/Float64Dtype. Converting
an Arrow float column to those dtypes turns IEEE NaN into pd.NA, and
to_numpy(na_value=None) then returns None for it, so a NaN value could
not be told apart from SQL NULL. With _disable_pandas=True the same data
already came back as float('nan').
After building the object array, set NaN back on the cells that are NaN
in the Arrow column, using a vectorized pyarrow.compute.is_nan mask.
NULL stays None, other values are unchanged, and tables without float
columns take no extra work.
Signed-off-by: Maha Rana Yadavalli <[email protected]>
maharanay22
force-pushed
the
fix-nan-float-null-conversion
branch
from
2057880 to
2546c2f
Compare
vuanhphung
reviewed
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the contribution! I think we should add some cheap optimization such as to reduce the overhead of this conversion
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsSigned-off-by: Maha Rana Yadavalli <[email protected]>
|
There was an error while loading. Please reload this page.
|
@vuanhphung thanks, good idea. I added the early exit when a column has no NaN and fill nulls in the mask before indexing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Signed-off-by: Maha Rana Yadavalli <[email protected]>
|
@vuanhphung merged main into this, #977 and #982 to resolve the CHANGELOG conflict with 4.9.0. Could you approve the CI runs when you have time? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Signed-off-by: Maha Rana Yadavalli <[email protected]>
|
@vuanhphung I addressed your review. Could you take another look when you have time? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
NaN in FLOAT/DOUBLE columns is returned as None (same as NULL) when pandas is enabled
There was an error while loading. Please reload this page.