superset icon indicating copy to clipboard operation
superset copied to clipboard

[sqlite] time grain isn't set properly

Open csc5k opened this issue 9 years ago • 18 comments

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

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

Superset version

0.20.4

Expected results

When editing a bar graph slice, specify a time grain of "week" X-axis of the bar graph runs on a weekly interval

The same would be true of "month" granularity

Actual results

When editing a bar graph slice, specify a time grain of "week" X-axis of the bar graph remains on a daily interval

The same is true of "month" granularity

Steps to reproduce

Specify a time grain of "week" for a bar graph slice Run Query in slice editor or save slice and view dashboard

I tried manually editing the "time_grain_sqla" parameter in the slice editor to be set to "week," it caused no effect.

csc5k avatar Oct 31 '17 06:10 csc5k

Please open bugs only against latest release. A lot has been fixed since 0.19.0

xrmx avatar Oct 31 '17 08:10 xrmx

OK. Can you let me know if this has been fixed in subsequent releases or point me to documentation that would provide this info?

csc5k avatar Oct 31 '17 08:10 csc5k

Sorry, but the burden on verifying it's fixed or not is on you. The point of reproducing with latest release is not to waste time to research stuff that may be already be fixed :)

xrmx avatar Oct 31 '17 08:10 xrmx

Let me rephrase the second part of my post: where are the release notes?

csc5k avatar Oct 31 '17 08:10 csc5k

I upgraded Superset and the problem still persists.

csc5k avatar Nov 01 '17 09:11 csc5k

I upgraded Superset and the problem still persists. The x-axis does not change granularity as I adjust the time grain in the slice.

csc5k avatar Nov 02 '17 09:11 csc5k

Is this the "Time Series - Bar Chart" or the "Distribution - Bar Chart" ?

mistercrunch avatar Nov 04 '17 07:11 mistercrunch

Time Series - Bar Chart

csc5k avatar Nov 06 '17 06:11 csc5k

Which database backend is this?

mistercrunch avatar Nov 06 '17 07:11 mistercrunch

SQLite 3

On Mon, Nov 6, 2017 at 10:05 AM, Maxime Beauchemin <[email protected]

wrote:

Which database backend is this?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/apache/incubator-superset/issues/3746#issuecomment-342063181, or mute the thread https://github.com/notifications/unsubscribe-auth/Afh_uIhkkXaB6Ax7kFV9rhFcfhc79ikAks5szq-fgaJpZM4QMSP3 .

csc5k avatar Nov 06 '17 07:11 csc5k

I can't reproduce with the example data...

mistercrunch avatar Nov 06 '17 07:11 mistercrunch

do you want to get on a Google hangout or something so I can show you what I'm seeing? or I can send screenshots

On Mon, Nov 6, 2017 at 10:08 AM, Maxime Beauchemin <[email protected]

wrote:

I can't reproduce with the example data...

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/apache/incubator-superset/issues/3746#issuecomment-342063738, or mute the thread https://github.com/notifications/unsubscribe-auth/Afh_uKHLuBAa6R6dFEmqL6Z5-esj1996ks5szrB4gaJpZM4QMSP3 .

csc5k avatar Nov 06 '17 07:11 csc5k

Daily time grain: [image: Inline image 1]

Weekly time grain (I clicked Run Query to update it): [image: Inline image 2]

I want to see the data aggregated for each week

On Mon, Nov 6, 2017 at 10:21 AM, Clay Crosby [email protected] wrote:

do you want to get on a Google hangout or something so I can show you what I'm seeing? or I can send screenshots

On Mon, Nov 6, 2017 at 10:08 AM, Maxime Beauchemin < [email protected]> wrote:

I can't reproduce with the example data...

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/apache/incubator-superset/issues/3746#issuecomment-342063738, or mute the thread https://github.com/notifications/unsubscribe-auth/Afh_uKHLuBAa6R6dFEmqL6Z5-esj1996ks5szrB4gaJpZM4QMSP3 .

csc5k avatar Nov 06 '17 09:11 csc5k

Get the same error. Checked the SQL and it seems that the parameter for strftime is set incorrectly all the time.

Weekly:

SELECT DATE(cancel_time, -strftime('%%w', cancel_time) || ' days') AS __timestamp,
       COUNT(ordernumber) AS count
FROM canc_reasons
WHERE cancel_time >= '2017-11-07 00:00:00.000000'
  AND cancel_time <= '2017-11-14 20:17:56.000000'
GROUP BY DATE(cancel_time, -strftime('%%w', cancel_time) || ' days')
ORDER BY count DESC
LIMIT 50000
OFFSET 0

Monthly:

SELECT DATE(cancel_time, -strftime('%%d', cancel_time) || ' days', '+1 day') AS __timestamp,
       COUNT(ordernumber) AS count
FROM canc_reasons
WHERE cancel_time >= '2017-11-07 00:00:00.000000'
  AND cancel_time <= '2017-11-14 20:20:18.000000'
GROUP BY DATE(cancel_time, -strftime('%%d', cancel_time) || ' days', '+1 day')
ORDER BY count DESC
LIMIT 50000
OFFSET 0

JeyKJey avatar Nov 14 '17 19:11 JeyKJey

Here's where it's defined in the source if someone wants to tackle this. https://github.com/apache/incubator-superset/blob/master/superset/db_engine_specs.py#L296

mistercrunch avatar Nov 15 '17 05:11 mistercrunch

Same issue for Clickhouse data source on version 0.22.1

SELECT toStartOfMinute(toDateTime(dt)) AS __timestamp, COUNT(*) AS number_of_requests FROM abc WHERE DateReceived >= toDateTime('2018-02-24 00:00:00') AND DateReceived <= toDateTime('2018-02-24 23:59:59') AND dt >= toDate('2018-02-24') AND dt <= toDate('2018-02-24') GROUP BY toStartOfMinute(toDateTime(dt)) ORDER BY number_of_requests DESC LIMIT 5000

tony0918 avatar Mar 05 '18 05:03 tony0918

Attn: @claycrosby @jkokatjuhha I am unable to to replicate this bug; have you tested against a fresh version? If it's still present I can work on this issue if someone can help me reproduce the problem.

villebro avatar Mar 27 '18 18:03 villebro

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

stale[bot] avatar Apr 11 '19 01:04 stale[bot]