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

Fix prev/next expression examples #3637

Open
wants to merge 5 commits into
base: latest
Choose a base branch
from

Conversation

intermittentnrg
Copy link
Contributor

Description

[Short summary of why you created this PR]

Links

Fixes #[insert issue link, if any]

Writing help

For information about style and word usage, see the style guide

Review checklists

Reviewers: use this section to ensure you have checked everything before approving this PR:

Subject matter expert (SME) review checklist

  • Is the content technically accurate?
  • Is the content complete?
  • Is the content presented in a logical order?
  • Does the content use appropriate names for features and products?
  • Does the content provide relevant links to further information?

Documentation team review checklist

  • Is the content free from typos?
  • Does the content use plain English?
  • Does the content contain clear sections for concepts, tasks, and references?
  • Have any images been uploaded to the correct location, and are resolvable?
  • If the page index was updated, are redirects required
    and have they been implemented?
  • Have you checked the built version of this content?

@billy-the-fish
Copy link
Contributor

Hi @intermittentnrg, thanks for this work. Is this PR still a draft or are you ready for review? Iain

@intermittentnrg intermittentnrg marked this pull request as ready for review February 19, 2025 07:09
@intermittentnrg
Copy link
Contributor Author

Ready for review. I tested & used the updated queries. But in the end couldn't use prev expression because there were no datapoints in queried range and prev expression is only used for datapoints within range.

@billy-the-fish
Copy link
Contributor

Thanks @intermittentnrg , much appreciated.

@@ -75,17 +75,19 @@ to fill gaps at the beginning of the queried time range. Note that the

```sql
SELECT time_bucket_gapfill('1 day', time) AS day,
device_id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this to the group by clause too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes good point. GROUP BY device_id, day.

device_id should be either in GROUP BY or WHERE to make query realistic.

LIMIT 1
)
) as value
FROM metrics
FROM metrics m
WHERE time > '2021-12-31 00:00:00+00'::timestamptz
AND time < '2022-01-10 00:00:00-00'::timestamptz
GROUP BY day
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GROUP BY day
GROUP BY day, device_id

LIMIT 1
)
) as value
FROM metrics
FROM metrics m
WHERE time > '2021-12-31 00:00:00+00'::timestamptz
AND time < '2022-01-10 00:00:00-00'::timestamptz
GROUP BY day
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GROUP BY day
GROUP BY day, device_id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants