Skip to content

Conversation

@sumankarki
Copy link
Contributor

This PR supports datemath for the between operator where both date arguments are the valid date eval expression like "now-1d" .

}

// NewDateConverter takes a node expression
func NewDateConverter(ctx expr.EvalIncludeContext, n expr.Node) (*DateConverter, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some tests that this behavior matches the timewindow function?

Copy link
Contributor

Choose a reason for hiding this comment

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

vm/datemath.go Outdated
// and "exits" the expression by passing the lower bound and sliding out of the window. Although the "Upper Bound" is after the "Lower Bound",
// the order of entry and exit is reversed. This example should show how the entity appears to move backwards as the window moves forward.
// Example timeline: Ct = 01/22/2025 00:00:00
// Day 0: now = 01/22/2025 00:00:00 === Lb--Ct++Ub+++++++++
Copy link
Member

Choose a reason for hiding this comment

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

this is a little confusion on first read - can you add a comment to explain the -/+ here?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a bit my fault... It was supposed to represent some static days
Ct is static day, and --- was supposed to be the days before that, with a + representing a day after that... which would sort of help visualize the window sliding forward... so some of those minuses in the last 4 lines here should actually be + in that regard.

There is probably a better way to indicate the different timings, but pretty sure Suman just grabbed this directly from the markup I drafted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I will clean it up. It looked good so thought will help in the future knowing whats going on.

@sumankarki sumankarki force-pushed the 36708-support-between-datemath branch from 2688180 to a1fa259 Compare May 22, 2025 17:06
@sumankarki sumankarki force-pushed the 36708-support-between-datemath branch from f917bac to f02c936 Compare May 27, 2025 20:09
@sumankarki sumankarki merged commit 7809f53 into master May 27, 2025
1 check passed
@sumankarki sumankarki deleted the 36708-support-between-datemath branch May 27, 2025 20:29
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.

5 participants