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

[druid] fix 'Unorderable types' when col has nulls #4771

Closed
wants to merge 2 commits into from

Conversation

mistercrunch
Copy link
Member

Error "unorderable types: str() < int()" occurs when grouping by a
numerical Druid colummn that contains null values.

  • druid/pydruid returns strings in the datafram with NAs for nulls
  • Superset has custom logic around get_fillna_for_col that fills in the
    NULLs based on declared column type (FLOAT here), so now we have a mixed
    bag of type in the series
  • pandas chokes on pivot_table or groupby operations as it cannot sorts
    mixed types

The approach here is to stringify and fillna('') to get a
consistent series.

Related: #3029

Error "unorderable types: str() < int()" occurs when grouping by a
numerical Druid colummn that contains null values.

* druid/pydruid returns strings in the datafram with NAs for nulls
* Superset has custom logic around get_fillna_for_col that fills in the
NULLs based on declared column type (FLOAT here), so now we have a mixed
bag of type in the series
* pandas chokes on pivot_table or groupby operations as it cannot sorts
mixed types

The approach here is to stringify and fillna('<NULL>') to get a
consistent series.
@codecov-io
Copy link

Codecov Report

Merging #4771 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #4771      +/-   ##
=========================================
+ Coverage   72.59%   72.6%   +<.01%     
=========================================
  Files         205     205              
  Lines       15401   15406       +5     
  Branches     1183    1183              
=========================================
+ Hits        11180   11185       +5     
  Misses       4218    4218              
  Partials        3       3
Impacted Files Coverage Δ
superset/connectors/druid/models.py 81.73% <100%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 92230b8...5e4888a. Read the comment docs.

@mistercrunch mistercrunch changed the title [druid] fix 'Unorderable types' when col has nuls [druid] fix 'Unorderable types' when col has nulls Apr 6, 2018
Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

Looks good, but can we add unit tests for the homogenize_types function, and even maybe a druid test where we have NULLs in the data?

@mistercrunch
Copy link
Member Author

Merging onto #4651

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants