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: return appropriate response when payload has error #12575

Merged
merged 1 commit into from Jan 19, 2021

Conversation

zhaoyongjie
Copy link
Member

SUMMARY

Raise an unexpected exception when an empty query in the results panel

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

before

image

after

image

TEST PLAN

Tested in my local environment

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@codecov-io
Copy link

codecov-io commented Jan 18, 2021

Codecov Report

Merging #12575 (0f243c6) into master (f24d3cb) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12575      +/-   ##
==========================================
- Coverage   66.75%   66.75%   -0.01%     
==========================================
  Files        1015     1015              
  Lines       49633    49634       +1     
  Branches     4839     4839              
==========================================
- Hits        33133    33131       -2     
- Misses      16377    16380       +3     
  Partials      123      123              
Flag Coverage Δ
cypress 50.98% <100.00%> (ø)
javascript 60.74% <100.00%> (ø)
python 63.95% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...tend/src/dashboard/components/DashboardBuilder.jsx 86.41% <100.00%> (ø)
superset/dashboards/filters.py 96.96% <100.00%> (-0.09%) ⬇️
superset/views/base.py 75.41% <100.00%> (+0.20%) ⬆️
superset/db_engine_specs/presto.py 81.38% <0.00%> (-0.65%) ⬇️

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 f24d3cb...1b7b10d. Read the comment docs.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

Did you check if the same should apply to sample requests? https://github.com/apache/superset/blob/master/superset/viz.py#L257-L258

@zhaoyongjie
Copy link
Member Author

@villebro
Because get_samples always contains columns key in query_obj, so get_sample will always return a dataframe.

superset/superset/viz.py

Lines 246 to 258 in 0f243c6

def get_samples(self) -> List[Dict[str, Any]]:
query_obj = self.query_obj()
query_obj.update(
{
"groupby": [],
"metrics": [],
"orderby": [],
"row_limit": config["SAMPLES_ROW_LIMIT"],
"columns": [o.column_name for o in self.datasource.columns],
}
)
df = self.get_df_payload(query_obj)["df"] # leverage caching logic
return df.to_dict(orient="records")

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

Ok thanks for the correction @zhaoyongjie !

@zhaoyongjie zhaoyongjie merged commit e7a5d0d into apache:master Jan 19, 2021
@mistercrunch mistercrunch added 🍒 1.0.1 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 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 size/XS v1.0.1 🍒 1.0.1 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants