jrf 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jrf/row_context.rb +2 -2
- data/lib/jrf/version.rb +1 -1
- data/test/jrf_test.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0a1ab5bb43a602346df298f2827aaa9de7d418fcc7f090517ccb5c47f66081c6
|
|
4
|
+
data.tar.gz: 79181c2bb2689146e5b48d13bb1cdf3c740e86f61067862112f3fb2e81821b28
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b57e5b2f895420eb7c6a3a59d40a3f3213768eba4bef8125f3e8c6b77a4d6fa818c803a174ea37fa6dc12bca594f52949a9ba623205e089acb5cc1993d9d7ac
|
|
7
|
+
data.tar.gz: 6c2a48e7db8074eac45a24bdcdcc41f304c2997e03e8ba43f1a28bf152195ef2ce3515ca9a3609cd17cd840849e91ef3eb4b5b9115282ae2c7187f0186a9475e
|
data/lib/jrf/row_context.rb
CHANGED
|
@@ -136,9 +136,9 @@ module Jrf
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
define_reducer(:percentile) do |ctx, value, percentage, block: nil|
|
|
139
|
-
|
|
139
|
+
scalar = !percentage.is_a?(Enumerable)
|
|
140
|
+
percentages = scalar ? [percentage] : percentage.to_a
|
|
140
141
|
percentages.each { |p| ctx.send(:validate_percentile!, p) }
|
|
141
|
-
scalar = !percentage.is_a?(Array)
|
|
142
142
|
|
|
143
143
|
finish =
|
|
144
144
|
if scalar
|
data/lib/jrf/version.rb
CHANGED
data/test/jrf_test.rb
CHANGED
|
@@ -469,6 +469,14 @@ assert_equal(
|
|
|
469
469
|
"array percentile output"
|
|
470
470
|
)
|
|
471
471
|
|
|
472
|
+
stdout, stderr, status = run_jrf('percentile(_["foo"], 0.25.step(1.0, 0.25))', input_sum)
|
|
473
|
+
assert_success(status, stderr, "enumerable percentile")
|
|
474
|
+
assert_equal(
|
|
475
|
+
['[1,2,3,4]'],
|
|
476
|
+
lines(stdout),
|
|
477
|
+
"enumerable percentile output"
|
|
478
|
+
)
|
|
479
|
+
|
|
472
480
|
input_with_nil = <<~NDJSON
|
|
473
481
|
{"foo":1}
|
|
474
482
|
{"foo":null}
|