Skip to content

[6.0.0-RC2] Superset+StarRocks: Error with timestamp handling in line chart #35271

@maanwater

Description

@maanwater

Bug description

I’m experiencing a bug in 6.0.0 RC2 (was there in RC1 already as well) for a line chart with minute time grain using StarRocks as database.

In our prod environment (v5.0.0) the graph looks like the first graph while in our nonprod environment (v6.0.0 RC2) it look like the second graph.

Comparing both generated SQL statements, it appears that in v6.0.0 RC2 there is a missing “DATE()” section in the “DATE_ADD()” function (see code snippet below). However, if I manually add this and execute the query in SQL_lab, the result is the same.

The issue seems to be that in v6.0.0 the timestamp is not being grouped at the minute level. Screenshot 3 gives the result in SQL lab for v5.0.0, screenshot 4 the exact same query in v6.0.0.
Also mark that the query in v6.0.0 gives results for timestamps which should not be possible according to my WHERE clause.

The SQL code behind the correct line chart in Apache Superset v5.0.0
SELECT DATE_ADD( DATE(TIMESTAMPADD(HOUR,2,timestamp)), INTERVAL ( HOUR(TIMESTAMPADD(HOUR,2,timestamp))*60 + MINUTE(TIMESTAMPADD(HOUR,2,timestamp)) ) MINUTE ), COUNT(event_id) as count FROM starrocks.events WHERE timestamp >= STR_TO_DATE('2025-09-23 00:00:00.000000', '%Y-%m-%d %T.%f') AND timestamp < STR_TO_DATE('2025-09-23 11:32:16.000000', '%Y-%m-%d %T.%f') AND event_name IN ('page_impression') GROUP BY DATE_ADD( DATE(TIMESTAMPADD(HOUR,2,timestamp)), INTERVAL ( HOUR(TIMESTAMPADD(HOUR,2,timestamp))*60 + MINUTE(TIMESTAMPADD(HOUR,2,timestamp)) ) MINUTE ) ORDER BY count DESC LIMIT 5000;

The SQL code behind the incorrect line chart in Apache Superset v6.0.0 RC2
SELECT DATE_ADD( TIMESTAMPADD(HOUR, 2, timestamp), INTERVAL ( HOUR(TIMESTAMPADD(HOUR, 2, timestamp)) * 60 + MINUTE(TIMESTAMPADD(HOUR, 2, timestamp)) ) MINUTE ), COUNT(event_id) as count FROM starrocks.events WHERE timestamp >= STR_TO_DATE('2025-09-23 00:00:00.000000', '%Y-%m-%d %T.%f') AND timestamp < STR_TO_DATE('2025-09-23 11:32:16.000000', '%Y-%m-%d %T.%f') AND event_name IN ('page_impression') GROUP BY DATE_ADD( TIMESTAMPADD(HOUR, 2, timestamp), INTERVAL ( HOUR(TIMESTAMPADD(HOUR, 2, timestamp)) * 60 + MINUTE(TIMESTAMPADD(HOUR, 2, timestamp)) ) MINUTE ) ORDER BY count DESC LIMIT 5000

Screenshots/recordings

Line chart with minute time grain in v5.0.0
Image

The table view behind the line chart
Image

Line chart with minute time grain in v6.0.0
Image

The table view behind the line chart is not grouping by minute and contains elements from outside the period in the WHERE clause
Image

Superset version

master / latest-dev

Python version

3.10

Node version

18 or greater

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions