Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test
  • Loading branch information
beliefer committed Nov 3, 2021
commit a2f1fbbb2f74afefe802624700887ae89dfc7591
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ class StreamingQueryListenerSuite extends StreamTest with BeforeAndAfter {
min($"value").as("min_val"),
max($"value").as("max_val"),
sum($"value").as("sum_val"),
count(when($"value" % 2 === 0, 1)).as("num_even"))
count(when($"value" % 2 === 0, 1)).as("num_even"),
percentile_approx($"value", lit(0.5), lit(100)).as("percentile_approx_val"))
.observe(
name = "other_event",
avg($"value").cast("int").as("avg_val"))
Expand All @@ -444,15 +445,15 @@ class StreamingQueryListenerSuite extends StreamTest with BeforeAndAfter {
AddData(inputData, 1, 2),
AdvanceManualClock(100),
checkMetrics { metrics =>
assert(metrics.get("my_event") === Row(1, 2, 3L, 1L))
assert(metrics.get("my_event") === Row(1, 2, 3L, 1L, 1))
assert(metrics.get("other_event") === Row(1))
},

// Batch 2
AddData(inputData, 10, 30, -10, 5),
AdvanceManualClock(100),
checkMetrics { metrics =>
assert(metrics.get("my_event") === Row(-10, 30, 35L, 3L))
assert(metrics.get("my_event") === Row(-10, 30, 35L, 3L, 5))
assert(metrics.get("other_event") === Row(8))
},

Expand Down