Clean up SQL time interval math expressions#796
Merged
Conversation
The original implementation of SqlTimeDeltaExpression had a custom override for grain_to_date intended to support cumulative metrics. This parameter would change the expression from a time delta to a date_trunc. At some point we cleaned up the callsites to invoke date_trunc directly instead of offloading this work to an overloaded class. This commit simply removes the confusing parameter in order to streamline the expression rendering for time delta operations.
The original name for this class was misleading, as a time delta is effectively an interval computed as a difference. This suggested either that the rendering should be a date_diff to produce an interval between two timestamps, or that it should be an interval expression for use in some other operation. In reality, this class provides the functionality of a date_subtract, where we subtract an interval value from a given input timestamp.
We had a couple of copy/paste issues with sql expression nodes identifying themselves as IS_NULL expressions. This tidies that up.
Contributor
Author
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
|
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
plypaul
approved these changes
Oct 5, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Our time interval math expressions were originally represented in a class called
SqlTimeDeltaExpression. There were two issues with this:
from an input time value.
it's behavior from rendering an interval subtraction to rendering date_trunc
This PR addresses both of these, and improves some of the documentation and class
labeling properties as part of these updates.