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

Add derivative function #81178

Merged
merged 9 commits into from
Nov 2, 2020
Merged

Conversation

flash1293
Copy link
Contributor

@flash1293 flash1293 commented Oct 20, 2020

Related to #61775

This adds a derivative expression function similar to the existing cumulative sum function, pulling some helpers into a shared file.

Similar to #80129

@flash1293 flash1293 marked this pull request as ready for review October 20, 2020 17:25
@flash1293 flash1293 requested a review from a team as a code owner October 20, 2020 17:25
@botelastic botelastic bot added the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label Oct 21, 2020
@flash1293 flash1293 added release_note:skip Skip the PR/issue when compiling release notes v7.11.0 v8.0.0 labels Oct 21, 2020
Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

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

Code LGTM! Tested a little bit and found it was working in a way that's consistent with ES defaults. You could leave a note about the insert_zeroes behavior which ES supports, since it's not supported here, but it's what I expected.

Edit: What about changing the name to something like deltas/differences?

@wylieconlon
Copy link
Contributor

@elasticmachine merge upstream

@flash1293
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@mbondyra mbondyra left a comment

Choose a reason for hiding this comment

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

Code lgtm.

expect(result.rows.map((row) => row.output)).toEqual([undefined, 7 - 5, 3 - 7, 2 - 3]);
});

it('casts values to number before calculating cumulative sum for NaN like values', () => {
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
it('casts values to number before calculating cumulative sum for NaN like values', () => {
it('casts values to number before calculating derivative for NaN like values', () => {

@mbondyra
Copy link
Contributor

@flash1293 now when I am looking at the code again, I feel like there's possibly one test missing – all works well, but as we have some non-strict equality check, could we include testing of '0's (zeros)?

@flash1293
Copy link
Contributor Author

@mbondyra Great suggestion, I added a test for this.

@flash1293
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

@kbn/optimizer bundle module count

id before after diff
expressions 103 105 +2

distributable file count

id before after diff
default 48125 48127 +2
oss 28587 28589 +2

page load bundle size

id before after diff
expressions 182.2KB 186.7KB +4.5KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@flash1293 flash1293 merged commit 2dcb6b4 into elastic:master Nov 2, 2020
flash1293 added a commit to flash1293/kibana that referenced this pull request Nov 2, 2020
gmmorris added a commit to gmmorris/kibana that referenced this pull request Nov 2, 2020
* master:
  Add derivative function (elastic#81178)
  [Discover] Deangularize context_app.html, part 3 (elastic#81838)
  [Visualize] Vis listing page breaks on unknown vis type (elastic#82018)
  Rename `batchSize` parameter to `batch_size` to be consisten with the API namings guidelines. (elastic#82123)
  Minor edits in Single Metric Viewer (elastic#82159)
  [Actions] Fix type contract (elastic#82168)
  Upgrade EUI to v30.1.1 (elastic#81499)
  Skip failing ES snapshot test (elastic#82207)
  Skip ES snapshot failing suite (elastic#82206)
  [Alerting UI] Grouped list of alert types using producers in Types filter of Alerts tab (elastic#81876)
  [Maps] convert vector style component to typescript round 1 (elastic#81961)
  Fix link to upgrade assistant (elastic#82138)
  Rename "service overview" to "service inventory" (elastic#81933)
  adjust policy test to drop test for server addresses (elastic#82120)
  Cleanup/codeowners (elastic#82146)
  [DOCS] Updates add data content (elastic#81093)
  [DOCS] Remove index mgmt docs (elastic#82099)
  [Search] fix cancelation related memory leaks (elastic#81996)
flash1293 added a commit that referenced this pull request Nov 2, 2020
phillipb added a commit to phillipb/kibana that referenced this pull request Nov 2, 2020
…e-details-overlay

* 'master' of github.com:elastic/kibana: (72 commits)
  [CCR] Update README.md on how to start 2 clusters for testing (elastic#81487)
  [APM] Scale transaction rate correctly (elastic#82155)
  Upgrade to hapi version 18 (elastic#80468)
  [Uptime] Remove custom handling of license enabling (elastic#82019)
  [Telemetry] Remove `from` and `to` timestamps from usage stats APIs (elastic#81579)
  Enable send to background in Vega (elastic#82229)
  Enable send to background in Timelion (elastic#82232)
  [Actions & Connectors] removes Connector flyouts after usage (elastic#82126)
  Add derivative function (elastic#81178)
  [Discover] Deangularize context_app.html, part 3 (elastic#81838)
  [Visualize] Vis listing page breaks on unknown vis type (elastic#82018)
  Rename `batchSize` parameter to `batch_size` to be consisten with the API namings guidelines. (elastic#82123)
  Minor edits in Single Metric Viewer (elastic#82159)
  [Actions] Fix type contract (elastic#82168)
  Upgrade EUI to v30.1.1 (elastic#81499)
  Skip failing ES snapshot test (elastic#82207)
  Skip ES snapshot failing suite (elastic#82206)
  [Alerting UI] Grouped list of alert types using producers in Types filter of Alerts tab (elastic#81876)
  [Maps] convert vector style component to typescript round 1 (elastic#81961)
  Fix link to upgrade assistant (elastic#82138)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) release_note:skip Skip the PR/issue when compiling release notes v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants