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(datasource): saving new calculated columns #23783

Conversation

Always-prog
Copy link
Contributor

SUMMARY

Creating a new calculated columns isn't working.
Because the datasource is receiving a string ID from the frontend, which is resulting in invalid input.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

2023-04-22_19-18-21.mp4

After

2023-04-22_19-15-44.mp4

TESTING INSTRUCTIONS

  1. Go to any datasource
  2. Add calculated column
  3. See an error

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

CC @jfrag1 #23678

@codecov
Copy link

codecov bot commented Apr 22, 2023

Codecov Report

Merging #23783 (2d403c2) into master (4b3e507) will increase coverage by 0.07%.
The diff coverage is 84.57%.

❗ Current head 2d403c2 differs from pull request most recent head 8f26348. Consider uploading reports for the commit 8f26348 to get more accurate results

@@            Coverage Diff             @@
##           master   #23783      +/-   ##
==========================================
+ Coverage   67.87%   67.95%   +0.07%     
==========================================
  Files        1925     1933       +8     
  Lines       74389    74752     +363     
  Branches     8108     8108              
==========================================
+ Hits        50494    50799     +305     
- Misses      21818    21876      +58     
  Partials     2077     2077              
Flag Coverage Δ
hive 53.00% <63.43%> (+0.07%) ⬆️
mysql 78.79% <84.57%> (+0.05%) ⬆️
postgres 78.87% <84.57%> (+0.05%) ⬆️
presto 52.92% <63.43%> (+0.08%) ⬆️
python 82.66% <84.57%> (+0.01%) ⬆️
sqlite 77.38% <84.57%> (+0.06%) ⬆️
unit 52.81% <63.68%> (+0.08%) ⬆️

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

Impacted Files Coverage Δ
...chart-echarts/src/Timeseries/EchartsTimeseries.tsx 0.00% <ø> (ø)
...tend/src/components/Datasource/DatasourceModal.tsx 75.00% <ø> (ø)
superset-frontend/src/views/routes.tsx 51.11% <ø> (ø)
...rontend/src/visualizations/FilterBox/FilterBox.jsx 49.61% <ø> (ø)
...c/visualizations/FilterBox/FilterBoxChartPlugin.js 66.66% <ø> (ø)
superset/models/sql_lab.py 78.40% <42.85%> (-1.11%) ⬇️
superset/db_engine_specs/ocient.py 57.28% <57.28%> (ø)
superset/dao/base.py 92.85% <70.00%> (-2.60%) ⬇️
...uperset/row_level_security/commands/bulk_delete.py 87.50% <87.50%> (ø)
superset/connectors/sqla/views.py 89.71% <90.90%> (+0.91%) ⬆️
... and 12 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Always-prog
Copy link
Contributor Author

Always-prog commented Apr 22, 2023

Hello!
Integration test cases have returned an error, but there were no errors on the source branch from where I created the PR. Could we please re-run the CI tests?
Thanks!

Copy link
Member

@jfrag1 jfrag1 left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for catching this!

@@ -139,7 +139,7 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
),
columns: currentDatasource?.columns?.map(
(column: Record<string, unknown>) => ({
id: column.id,
id: typeof column.id !== 'string' ? column.id : undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Since we only accept Number or undefined, maybe it'd be more clear to compare to 'number'? Like typeof column.id === 'number' ? column.id : undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@eschutho eschutho merged commit 742c2cd into apache:master Apr 24, 2023
jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Apr 27, 2023
sebastianliebscher pushed a commit to sebastianliebscher/superset that referenced this pull request Apr 28, 2023
sadpandajoe added a commit to preset-io/superset that referenced this pull request May 5, 2023
sadpandajoe added a commit to preset-io/superset that referenced this pull request May 12, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 13, 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 preset:2023.17 size/XS 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants