You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/05/13 11:03:46 UTC

[GitHub] [superset] villebro opened a new pull request, #20055: fix(plugin-chart-echarts): support adhoc x-axis

villebro opened a new pull request, #20055:
URL: https://github.com/apache/superset/pull/20055

   ### SUMMARY
   Currently using a Custom SQL expression with the `GENERIC_CHART_AXES` produces unexpected results. Here we ensure all post processing operations that support generic x-axes also support custom SQL adhoc columns. In addition, the `transformProps` of the ECharts Timeseries chart is update to properly handle custom SQL adhoc columns.
   
   ### AFTER
   Now the chart renders as expected:
   <img width="935" alt="image" src="https://user-images.githubusercontent.com/33317356/168270256-0799423e-fe04-4ff4-b586-c2e0e68a6cf9.png">
   
   ### BEFORE
   Previously the chart data request returned zero rows:
   <img width="923" alt="image" src="https://user-images.githubusercontent.com/33317356/168270415-9c0d498c-f89b-4578-9f54-174281ad1701.png">
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kgabryje commented on a diff in pull request #20055: fix(plugin-chart-echarts): support adhoc x-axis

Posted by GitBox <gi...@apache.org>.
kgabryje commented on code in PR #20055:
URL: https://github.com/apache/superset/pull/20055#discussion_r872317925


##########
superset-frontend/packages/superset-ui-chart-controls/src/operators/pivotOperator.ts:
##########
@@ -31,11 +31,13 @@ export const pivotOperator: PostProcessingFactory<PostProcessingPivot> = (
 ) => {
   const metricLabels = ensureIsArray(queryObject.metrics).map(getMetricLabel);
   const { x_axis: xAxis } = formData;
+
   if ((xAxis || queryObject.is_timeseries) && metricLabels.length) {
+    const index = [getColumnLabel(formData.x_axis || DTTM_ALIAS)];

Review Comment:
   This or we can remove extracting xAxis from formData.x_axis in line 33



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rumbin commented on pull request #20055: fix(plugin-chart-echarts): support adhoc x-axis

Posted by GitBox <gi...@apache.org>.
rumbin commented on PR #20055:
URL: https://github.com/apache/superset/pull/20055#issuecomment-1126248445

   @villebro great, thanks a lot for fixing!
   Will this PR be included in the 1.5 LTS branch?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro merged pull request #20055: fix(plugin-chart-echarts): support adhoc x-axis

Posted by GitBox <gi...@apache.org>.
villebro merged PR #20055:
URL: https://github.com/apache/superset/pull/20055


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kgabryje commented on a diff in pull request #20055: fix(plugin-chart-echarts): support adhoc x-axis

Posted by GitBox <gi...@apache.org>.
kgabryje commented on code in PR #20055:
URL: https://github.com/apache/superset/pull/20055#discussion_r872320672


##########
superset-frontend/packages/superset-ui-chart-controls/src/operators/pivotOperator.ts:
##########
@@ -31,11 +31,13 @@ export const pivotOperator: PostProcessingFactory<PostProcessingPivot> = (
 ) => {
   const metricLabels = ensureIsArray(queryObject.metrics).map(getMetricLabel);
   const { x_axis: xAxis } = formData;
+
   if ((xAxis || queryObject.is_timeseries) && metricLabels.length) {
+    const index = [getColumnLabel(formData.x_axis || DTTM_ALIAS)];
     return {
       operation: 'pivot',
       options: {
-        index: [xAxis || DTTM_ALIAS],
+        index,

Review Comment:
   I think this looks good 👍 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on pull request #20055: fix(plugin-chart-echarts): support adhoc x-axis

Posted by GitBox <gi...@apache.org>.
villebro commented on PR #20055:
URL: https://github.com/apache/superset/pull/20055#issuecomment-1126249493

   > @villebro great, thanks a lot for fixing!
   > 
   > Will this PR be included in the 1.5 LTS branch?
   
   @rumbin you bet! 🙂👍


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on a diff in pull request #20055: fix(plugin-chart-echarts): support adhoc x-axis

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #20055:
URL: https://github.com/apache/superset/pull/20055#discussion_r872314671


##########
superset-frontend/packages/superset-ui-chart-controls/src/operators/pivotOperator.ts:
##########
@@ -31,11 +31,13 @@ export const pivotOperator: PostProcessingFactory<PostProcessingPivot> = (
 ) => {
   const metricLabels = ensureIsArray(queryObject.metrics).map(getMetricLabel);
   const { x_axis: xAxis } = formData;
+
   if ((xAxis || queryObject.is_timeseries) && metricLabels.length) {
+    const index = [getColumnLabel(formData.x_axis || DTTM_ALIAS)];
     return {
       operation: 'pivot',
       options: {
-        index: [xAxis || DTTM_ALIAS],
+        index,

Review Comment:
   I'm not sure which is better/more readable, inlining it or declaring it as a variable first. I went with declaring a `const` first, but looking at it now I should maybe have inlined it..



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #20055: fix(plugin-chart-echarts): support adhoc x-axis

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #20055:
URL: https://github.com/apache/superset/pull/20055#issuecomment-1125971497

   # [Codecov](https://codecov.io/gh/apache/superset/pull/20055?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#20055](https://codecov.io/gh/apache/superset/pull/20055?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3ca3b82) into [master](https://codecov.io/gh/apache/superset/commit/89a844a40f55d91d0ca1b6b737cc6a371f770149?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (89a844a) will **not change** coverage.
   > The diff coverage is `100.00%`.
   
   ```diff
   @@           Coverage Diff           @@
   ##           master   #20055   +/-   ##
   =======================================
     Coverage   66.35%   66.35%           
   =======================================
     Files        1712     1712           
     Lines       64097    64097           
     Branches     6744     6744           
   =======================================
     Hits        42534    42534           
     Misses      19850    19850           
     Partials     1713     1713           
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `51.31% <100.00%> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/20055?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...t-ui-chart-controls/src/operators/pivotOperator.ts](https://codecov.io/gh/apache/superset/pull/20055/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY2hhcnQtY29udHJvbHMvc3JjL29wZXJhdG9ycy9waXZvdE9wZXJhdG9yLnRz) | `100.00% <100.00%> (ø)` | |
   | [...ui-chart-controls/src/operators/prophetOperator.ts](https://codecov.io/gh/apache/superset/pull/20055/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY2hhcnQtY29udHJvbHMvc3JjL29wZXJhdG9ycy9wcm9waGV0T3BlcmF0b3IudHM=) | `100.00% <100.00%> (ø)` | |
   | [...controls/src/operators/timeComparePivotOperator.ts](https://codecov.io/gh/apache/superset/pull/20055/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY2hhcnQtY29udHJvbHMvc3JjL29wZXJhdG9ycy90aW1lQ29tcGFyZVBpdm90T3BlcmF0b3IudHM=) | `100.00% <100.00%> (ø)` | |
   | [...gin-chart-echarts/src/Timeseries/transformProps.ts](https://codecov.io/gh/apache/superset/pull/20055/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvVGltZXNlcmllcy90cmFuc2Zvcm1Qcm9wcy50cw==) | `57.89% <100.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/20055?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/20055?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [89a844a...3ca3b82](https://codecov.io/gh/apache/superset/pull/20055?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kgabryje commented on a diff in pull request #20055: fix(plugin-chart-echarts): support adhoc x-axis

Posted by GitBox <gi...@apache.org>.
kgabryje commented on code in PR #20055:
URL: https://github.com/apache/superset/pull/20055#discussion_r872317695


##########
superset-frontend/packages/superset-ui-chart-controls/src/operators/pivotOperator.ts:
##########
@@ -31,11 +31,13 @@ export const pivotOperator: PostProcessingFactory<PostProcessingPivot> = (
 ) => {
   const metricLabels = ensureIsArray(queryObject.metrics).map(getMetricLabel);
   const { x_axis: xAxis } = formData;
+
   if ((xAxis || queryObject.is_timeseries) && metricLabels.length) {
+    const index = [getColumnLabel(formData.x_axis || DTTM_ALIAS)];

Review Comment:
   ```suggestion
       const index = [getColumnLabel(xAxis || DTTM_ALIAS)];
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on a diff in pull request #20055: fix(plugin-chart-echarts): support adhoc x-axis

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #20055:
URL: https://github.com/apache/superset/pull/20055#discussion_r872335364


##########
superset-frontend/packages/superset-ui-chart-controls/src/operators/pivotOperator.ts:
##########
@@ -31,11 +31,13 @@ export const pivotOperator: PostProcessingFactory<PostProcessingPivot> = (
 ) => {
   const metricLabels = ensureIsArray(queryObject.metrics).map(getMetricLabel);
   const { x_axis: xAxis } = formData;
+
   if ((xAxis || queryObject.is_timeseries) && metricLabels.length) {
+    const index = [getColumnLabel(formData.x_axis || DTTM_ALIAS)];

Review Comment:
   Oops, good catch! 👍 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org