Line chart. Event annotation not work. error raised from python (raises every time): telegram-cloud-photo-size-4-5769422933448572157-y

How to reproduce the bug

  1. create a line chart
  2. add Event annotation
  3. click apply/ok and get the error

Screenshots

Screenshot 2023-06-13 at 10 17 06

Environment

  • superset version: 2.1.0
  • python version: 3.10

Checklist

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

Additional context

SQL server: psql 14 failed annotation with "superset annotation" and "table", same error.

works on 1.5.3, so feels like recent changes are breaking

Comment From: padbk

We have had the same error on 2.1.0 when adding interval annotations too:

column p1d does not exist

To fix, I had to add a column to the dataset called p1d that was the same as the time series column and that seems to allow the annotation layer to be rendered.

It shouldn't need that though, so this is very likely to be a bug.

Comment From: slavanorm

idk.. i created p1d and P1D cols and it still not working

Comment From: Mavyre

Same here but with 'P1M' column. Event Annotation on Mixed Chart. I can't understand what's going on, and sometimes it start to magically work

Comment From: azamrik

This issue seems to happen when adding annotations to a chart when:

  • It has time grain (p1d is daily grain, p1w is weekly, p1m is monthly, ...etc)
  • The chart is already part of a dashboard

A work around that worked for me is to recreate the chart with the annotation and then add it to the dashboard.

Comment From: Mavyre

This issue seems to happen when adding annotations to a chart when:

  • It has time grain (p1d is daily grain, p1w is weekly, p1m is monthly, ...etc)
  • The chart is already part of a dashboard

A work around that worked for me is to recreate the chart with the annotation and then add it to the dashboard.

Thanks for the comment. Gave me an idea that actually works: Checking "Override Time Grain" does the job for me, even if the chart already is part of a dashboard!

Comment From: aagorelik

The issue still persists (helm version 0.11.2), even when using Superset own Annotations Layer and Time Grain removed from the chart:

Apache Superset Line chart. Event annotation not work

Or when used own table (with, or without P1D field added; and with, or without Time Grain):

Apache Superset Line chart. Event annotation not work

Apache Superset Line chart. Event annotation not work

Comment From: oliverlambson

Same issue here 🤚

Comment From: konvica

Same issue. What solved it for me, was to recreate the annotations table outside of any dashboard and set time grain in the annotation table to "minute". For the line chart I use time grain "hour" or "minute".

Comment From: rusackas

Seems we have a couple workarounds, and I'm wondering if this is enough to close the issue. Since it's been silent for upward of 6 months, it's at risk of being closed as stale. Note that soon we'll also only support Superset 4.0 and up, once 4.1 is out. If people can make sure this is still an issue (it probably is) in 4.0, that'd be appreciated.

Comment From: sfirke

Using 4.0.2, I heard today from a user who has a problem with annotation layers sometimes adding, sometimes not, to the same chart. I was able to replicate it though I don't understand when it fails and when it succeeds. We don't get any error message at all, maybe that's because we're using a saved Superset annotation source instead of a table? We just can't click "apply" or "OK" on the modal. Seems related to this issue, maybe has the same underlying problem.

Just now I was unable to add it to a chart. I refreshed my browser and then I could add it 😕 No error message, nothing in the application logs.

Comment From: rusackas

I'm assuming this is still just as much of an issue today, but holler if anyone's perceived any change.

Comment From: aschmitz-crnc

This seems to be an issue still. I tried creating a new line chart and adding an annotation layer, and also get this error:

ERROR: Flight returned invalid argument error, with message: Column 'P1D' not found in any table

The whole annotation feature seems awfully flaky.

Comment From: rusackas

Agreed the annotation feature needs work (or an entire revamp). Any volunteers that want to fix this issue are welcome to do so, but otherwise this might be closed as "not planned" until someone (anyone) opens a SIP to propose a revised feature design and implementation.