zero-element commented on code in PR #25126:
URL: https://github.com/apache/superset/pull/25126#discussion_r1349713629


##########
tests/integration_tests/charts/data/api_tests.py:
##########
@@ -943,6 +944,71 @@ def test_chart_data_get(self):
         assert data["result"][0]["status"] == "success"
         assert data["result"][0]["rowcount"] == 2
 
+    @pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
+    def test_chart_data_get_with_x_axis_using_custom_sql(self):
+        """
+        Chart data API: Test GET endpoint
+        """
+        chart = db.session.query(Slice).filter_by(slice_name="Genders").one()
+        chart.query_context = json.dumps(
+            {
+                "datasource": {"id": chart.table.id, "type": "table"},
+                "force": False,
+                "queries": [
+                    {
+                        "time_range": "1900-01-01T00:00:00 : 
2000-01-01T00:00:00",
+                        "granularity": "ds",
+                        "filters": [
+                            {"col": "ds", "op": "TEMPORAL_RANGE", "val": "No 
filter"}
+                        ],
+                        "extras": {
+                            "having": "",
+                            "where": "",
+                        },
+                        "applied_time_extras": {},
+                        "columns": [
+                            {
+                                "columnType": "BASE_AXIS",
+                                "datasourceWarning": False,
+                                "expressionType": "SQL",
+                                "label": "My column",
+                                "sqlExpression": "ds",
+                                "timeGrain": "P1W",
+                            }
+                        ],

Review Comment:
   > Basically, the "granularity" and "Axis-column" shouldn't be concurrent 
sent from frontend. the "granularity" is a legacy Druid "concept"(and this 
concept as be wrapped under the hood in "modern" Druid), so from my original 
design would like to totally remove "granularity" in Superset, the 
"granularity" means that a temporal column in columns(or dimensions).
   
   I'm trying to fix [a bug related to 
granularity](https://github.com/apache/superset/issues/23384). Basically, the 
temporal granularity column should be renamed as "__timestamp" like what the 
legacy time series line chart did before(alias after group by should not be the 
same with the raw column name in clickhouse) but current chart don't, so 
granularity is a little different from other temporal columns(at least for 
users). If the "granularity" should be removed, should this bug be fixed on the 
frontend?
   
   it seems like the time column has been unusable for a very long time. thanks 
to this PR made custom SQL work



-- 
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-unsubscr...@superset.apache.org

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


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

Reply via email to