Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date operations like BETWEEN sometimes cause issues #73

Open
crisptrutski opened this issue Jun 20, 2024 · 1 comment
Open

Date operations like BETWEEN sometimes cause issues #73

crisptrutski opened this issue Jun 20, 2024 · 1 comment
Labels
bug Something isn't working .Team/BackendComponents

Comments

@crisptrutski
Copy link
Contributor

crisptrutski commented Jun 20, 2024

From the stats server:

SELECT date_trunc('month', instance_started)::date as month_started, count(*) AS "total_instances",
    avg(ts-instance_started) as avg_runtime,
    avg((stats->'user'->'users'->>'active')::int) as avg_active_users,
    percentile_disc(0.9) within group (order by (stats->'user'->'users'->>'active')::int) as p90_active_users,
    avg((stats->'question'->'questions'->>'total')::int) as avg_questions,
    percentile_disc(0.9) within group (order by (stats->'question'->'questions'->>'total')::int) as p90_questions,
    max((stats->'question'->'questions'->>'total')::int) as max_questions
  FROM "public"."usage_stats"
  WHERE (("public"."usage_stats"."instance_started" BETWEEN timestamp
    with time zone '2019-01-01 00:00:00.000-08:00' AND NOW()) AND ts-instance_started < INTERVAL '30 days')
  GROUP BY 1
  ORDER BY 1 ASC;

Error message

"net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: \"BETWEEN\" \"BETWEEN\"
      at line 9, column 51.
  
  Was expecting one of:
  
      \")\"
      \".\"
      \"::\"
      \"[\"
      \"^\"
@crisptrutski
Copy link
Contributor Author

As far as queries without tags go, there are 51 queries using BETWEEN that can be parsed, and only 2 that cannot.

@crisptrutski crisptrutski changed the title Date operations like BETWEEN are not supported Date operations like BETWEEN sometimes don't work Jul 10, 2024
@crisptrutski crisptrutski changed the title Date operations like BETWEEN sometimes don't work Date operations like BETWEEN sometimes cause issues Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .Team/BackendComponents
Projects
None yet
Development

No branches or pull requests

1 participant