villebro commented on a change in pull request #12665:
URL: https://github.com/apache/superset/pull/12665#discussion_r562428486
##########
File path: tests/core_tests.py
##########
@@ -889,6 +889,71 @@ def test_explore_json(self):
self.assertEqual(rv.status_code, 200)
self.assertEqual(data["rowcount"], 2)
+ @pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+ def test_explore_json_dist_bar_order(self):
+ tbl_id = self.table_ids.get("birth_names")
+ form_data = {
+ "datasource": f"{tbl_id}__table",
+ "viz_type": "dist_bar",
+ "url_params": {},
+ "time_range_endpoints": ["inclusive", "exclusive"],
+ "granularity_sqla": "ds",
+ "time_range": 'DATEADD(DATETIME("2021-01-21T00:00:00"), -1000,
year) : 2021-01-21T00:00:00',
+ "metrics": [
+ {
+ "expressionType": "SIMPLE",
+ "column": {
+ "id": 334,
+ "column_name": "name",
+ "verbose_name": "null",
+ "description": "null",
+ "expression": "",
+ "filterable": True,
+ "groupby": True,
+ "is_dttm": False,
+ "type": "VARCHAR(255)",
+ "python_date_format": "null",
+ },
+ "aggregate": "COUNT",
+ "sqlExpression": "null",
+ "isNew": False,
+ "hasCustomLabel": False,
+ "label": "COUNT(name)",
+ "optionName": "metric_hfypt74mt8n_u3vshxeegrl",
+ }
+ ],
Review comment:
Optional improvement: by adding another metric we could ensure that all
metrics are considered in the `ORDER BY` clause.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]