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

[fix] handle null column_name in druid/sqla models #7063

Merged

Conversation

graceguo-supercat
Copy link

@graceguo-supercat graceguo-supercat commented Mar 19, 2019

when sqla table column is null, see following exception:

Screen Shot 2019-03-19 at 11 59 31 AM

may related with #5445
@john-bodley @michellethomas @soboko @mistercrunch

@codecov-io
Copy link

codecov-io commented Mar 19, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7063      +/-   ##
==========================================
+ Coverage   64.57%   64.57%   +<.01%     
==========================================
  Files         422      422              
  Lines       20576    20577       +1     
  Branches     2251     2251              
==========================================
+ Hits        13286    13287       +1     
  Misses       7168     7168              
  Partials      122      122
Impacted Files Coverage Δ
superset/connectors/base/models.py 89.89% <100%> (+0.05%) ⬆️
superset/connectors/druid/models.py 82.74% <100%> (ø) ⬆️

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 33d67da...9857d04. Read the comment docs.

Copy link
Member

@john-bodley john-bodley left a comment

Choose a reason for hiding this comment

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

@graceguo-supercat the issue here is we would be replacing None with an empty string in the sorted list. We want to keep the sorted data intact so the following should work:

sorted([c.colum_name for c in self.columns], key=lambda x: x or '')

@kristw kristw added the !deprecated-label:bug Deprecated label - Use #bug instead label Mar 19, 2019
for s in sorted(self.column_names):
# self.column_names return sorted column_names
for s in self.column_names:
s = str(s or '')
Copy link
Member

Choose a reason for hiding this comment

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

I think your investigation surfaced that the are columns without a name which seems bad. I can look into why there are columns without names and produce a migration if needed.

I'm a little perplexed what order_by_choices means for empty strings and how this is used.

@graceguo-supercat
Copy link
Author

graceguo-supercat commented Mar 20, 2019

@john-bodley I found an example, it is used by Ordering control in explore view:
Screen Shot 2019-03-19 at 5 20 20 PM

datasource is part of bootstrap data which is sent to front-end at page load time:

Screen Shot 2019-03-19 at 5 25 49 PM

@john-bodley
Copy link
Member

@graceguo-supercat thanks for trouble shooting this. I plan on creating a migration tomorrow to remedy this issue which is related to ill-defined data as opposed to an underlying issue with the code.

@john-bodley
Copy link
Member

@graceguo-supercat I think #7067 should resolve these issues.

@graceguo-supercat
Copy link
Author

maybe useful for a quick solution in 0.31

@john-bodley
Copy link
Member

Now that #7067 has been closed (which was slated for v0.31) in favor of #5452 and #5453 which will not make it into v0.31 I agree that this is the best interim solution moving forward. Once these PRs are merged we can revert this PR.

@john-bodley john-bodley changed the title [fix] handle null column_name in sqla models [fix] handle null column_name in druid/sqla models Mar 23, 2019
@graceguo-supercat graceguo-supercat merged commit 60a7b6d into apache:master Mar 23, 2019
@graceguo-supercat graceguo-supercat deleted the gg-FixColumnNameNPE branch March 24, 2019 18:52
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels !deprecated-label:bug Deprecated label - Use #bug instead v0.31 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants