question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]: Sort By on table viz produces undesired results.

See original GitHub issue

A clear and concise description of what the bug is. Sort By on table viz produces undesired results.

Expected results

It should able to sort the result set.

Actual results

Adding an extra column in the result set - which is confusing.

Screenshots

image image image

How to reproduce the bug

  1. Go to source->tables->select bart_lines
  2. Click on bart_lines to explore data set
  3. Scroll down to “Sort By” (choose a column or aggregate function). Unable to select the Group by columns (see the screen shot). It forces to select aggregate function or custom sql otherwise it throws duplicate columns exception if custom sql column doesn’t have alias name.
  4. See error See attached screen shot (result window)

Environment

(please complete the following information):

  • superset version: 0.36.0, 0.35.2 and the master
  • python version: 3.6.8
  • node.js version: node -v
  • npm version: npm -v

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven’t found one similar.

Additional context

The explore request http://localhost:8088/superset/explore/?form_data={"datasource":"13__table","viz_type":"table","url_params":{},"time_range_endpoints":["inclusive","exclusive"],"granularity_sqla":null,"time_grain_sqla":"P1D","time_range":"Last+week","groupby":["name"],"metrics":[{"expressionType":"SIMPLE","column":{"id":456,"column_name":"color","verbose_name":null,"description":null,"expression":null,"filterable":true,"groupby":true,"is_dttm":false,"type":"VARCHAR(255)","optionName":"_col_color"},"aggregate":"COUNT","sqlExpression":null,"hasCustomLabel":false,"fromFormData":true,"label":"COUNT(color)","optionName":"metric_qqaak8p1tnh_c7yss63hqv7"}],"percent_metrics":[],"timeseries_limit_metric":{"expressionType":"SIMPLE","column":{"id":455,"column_name":"name","verbose_name":null,"description":null,"expression":null,"filterable":true,"groupby":true,"is_dttm":false,"type":"VARCHAR(255)","optionName":"_col_name"},"aggregate":"COUNT_DISTINCT","sqlExpression":null,"hasCustomLabel":false,"fromFormData":false,"label":"COUNT_DISTINCT(name)","optionName":"metric_r322b0kf66c_hctq4pk133v"},"row_limit":10000,"include_time":false,"order_desc":true,"all_columns":[],"order_by_cols":[],"adhoc_filters":[],"table_timestamp_format":"%Y-%m-%d+%H:%M:%S","page_length":0,"include_search":false,"table_filter":false,"align_pn":false,"color_pn":true,"show_cell_bars":true}

the query: SELECT name AS name, count(color) AS "COUNT(color)", **count(DISTINCT name) AS "COUNT_DISTINCT(name)"** FROM bart_lines GROUP BY name ORDER BY "COUNT_DISTINCT(name)" DESC LIMIT 10000;

To explore table viz, it should not force to select metrics aggregation instead it should provide columns to be selectable. I noticed the explore request “metrics” key in form_data includes “Sort By” value and it should not add it to the list. The “order_by” key has already the same value. Before, I submit the PR for this issue, need to understand the intend of “sort_by” for Table viz. Please, provide the context.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
villebrocommented, Apr 27, 2020

I believe this is a problem in the way table viz is currently implemented, and getting this functionality into the current sorting control can be difficult. The table viz is currently undergoing some refactoring, and I’ll try to keep this in mind to make sure it is addressed when the time is right.

1reaction
ktmudcommented, Jul 27, 2020

@RageAgainstTheMachine101 I think the issue with sort by being automatically added to display has already been fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG]: Sort By on table viz produces undesired results. #9620
Go to source->tables->select bart_lines · Click on bart_lines to explore data set · Scroll down to "Sort By" (choose a column or aggregate ......
Read more >
Microsoft Access tips: Order-By bug - Allen Browne
Demonstrates a bug in Microsoft Access, where a query returns fewer records when sorted via the interface.
Read more >
Z-Sort - Viz Artist User's Guide - Vizrt Documentation Center
This is a case where the positive role of the Depth-Buffer produces undesirable results. To avoid this undesirable result, Viz Artist splits the...
Read more >
How Analysis Works for Multi-table Data Sources that Use ...
Only data that is relevant to a viz is queried. The relationships between the tables affect the results of the query. The flow...
Read more >
Reference table for all security alerts in Microsoft Defender for ...
Microsoft Antimalware has encountered an error when taking an action on malware or other potentially unwanted software. -, Medium. Antimalware ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found