Skip to content

Instantly share code, notes, and snippets.

@welch welch/wtf.spec.md
Created Aug 19, 2015

Embed
What would you like to do?
why does the second test fail?

WTF?

The basic set, fed a steady stream of two groups; A group

Juttle

emit -from Date.new(0) -limit 10
| put T = Duration.seconds(time - Date.new(0))
| ( put name = "A" ; put name = "B", T = -T)
| (
    put a = avg(T), f = first(T) by name            | put ID=1;
)
| remove time
| filter name = "A"
| sort ID, name, T, a
| @result

Output

{ T: 0, name: "A", a: 0, f: 0, ID: 1 }
{ T: 1, name: "A", a: 0.5, f: 0, ID: 1 }
{ T: 2, name: "A", a: 1, f: 0, ID: 1 }
{ T: 3, name: "A", a: 1.5, f: 0, ID: 1 }
{ T: 4, name: "A", a: 2, f: 0, ID: 1 }
{ T: 5, name: "A", a: 2.5, f: 0, ID: 1 }
{ T: 6, name: "A", a: 3, f: 0, ID: 1 }
{ T: 7, name: "A", a: 3.5, f: 0, ID: 1 }
{ T: 8, name: "A", a: 4, f: 0, ID: 1 }
{ T: 9, name: "A", a: 4.5, f: 0, ID: 1 }

The basic set, fed a steady stream of two groups; B group

Juttle

emit -from Date.new(0) -limit 10
| put T = Duration.seconds(time - Date.new(0))
| ( put name = "A" ; put name = "B", T = -T)
| (
    put a = avg(T), f = first(T) by name            | put ID=1;
)
| remove time
| filter name = "B"
| sort ID, name, T, a
| @result

Output

{ T: -9, name: "B", a: -4.5, f: 0, ID: 1 }
{ T: -8, name: "B", a: -4, f: 0, ID: 1 }
{ T: -7, name: "B", a: -3.5, f: 0, ID: 1 }
{ T: -6, name: "B", a: -3, f: 0, ID: 1 }
{ T: -5, name: "B", a: -2.5, f: 0, ID: 1 }
{ T: -4, name: "B", a: -2, f: 0, ID: 1 }
{ T: -3, name: "B", a: -1.5, f: 0, ID: 1 }
{ T: -2, name: "B", a: -1, f: 0, ID: 1 }
{ T: -1, name: "B", a: -0.5, f: 0, ID: 1 }
{ T: 0, name: "B", a: 0, f: 0, ID: 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.