Skip to content

feat(sql): add difference and non_negative_difference sql functions#6858

Open
sanderson wants to merge 2 commits intomasterfrom
sql-difference-fn
Open

feat(sql): add difference and non_negative_difference sql functions#6858
sanderson wants to merge 2 commits intomasterfrom
sql-difference-fn

Conversation

@sanderson
Copy link
Collaborator

Summary

Adds documentation for difference and non_negative_difference SQL functions.

Checklist

  • Rebased/mergeable
  • Local build passes (npx hugo --quiet)

@sanderson sanderson requested a review from mhilton February 20, 2026 21:10
@sanderson sanderson requested a review from a team as a code owner February 20, 2026 21:10
@sanderson sanderson requested review from jstirnaman and removed request for a team February 20, 2026 21:10
@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2026

PR Preview Action v1.4.8
🚀 Deployed preview to https://influxdata.github.io/docs-v2/pr-preview/pr-6858/
on branch gh-pages at 2026-03-02 17:39 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2026

PR Preview

Status Details
Preview View preview
Pages 5 page(s) deployed
Build time 59s
Last updated 2026-03-02 17:39:58 UTC
Pages included in this preview
  • /influxdb3/cloud-dedicated/reference/sql/functions/window/
  • /influxdb3/cloud-serverless/reference/sql/functions/window/
  • /influxdb3/enterprise/reference/sql/functions/window/
  • /influxdb3/core/reference/sql/functions/window/
  • /influxdb3/clustered/reference/sql/functions/window/

Preview auto-deploys on push. Will be cleaned up when PR closes.

{{% show-in "cloud-serverless,cloud-dedicated" %}}
### difference

Returns the result of subtraction between subsequent values.
Copy link

Choose a reason for hiding this comment

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

I think the crucial bit of information that makes this different to using something like (c - LAG(c, 1)) OVER (...) is that it will skip over any number of NULL values to find the previous value to take the difference from.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the crucial bit of information that makes this different to using something like (c - LAG(c, 1)) OVER (...) is that it will skip over any number of NULL values to find the previous value to take the difference from.

@claude Update difference to make this distinction clear:
it uses the last previous non-NULL value to calculate the difference.

@jstirnaman jstirnaman added release:pending Waiting for product release before merging and removed Pending Release labels Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:pending Waiting for product release before merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants