Pipeline sink refactor (#1359)

* Refactor pipeline ahead of block changes. Add '-c' commandline option

* Update pipelining an error value

* Fmt

* Clippy

* Add stdin redirect for -c flag

* Add stdin redirect for -c flag
This commit is contained in:
Jonathan Turner
2020-02-08 18:24:33 -08:00
committed by GitHub
parent 3687603799
commit 5f4fae5b06
11 changed files with 221 additions and 81 deletions

View File

@ -204,6 +204,12 @@ pub struct SpannedExpression {
pub span: Span,
}
impl SpannedExpression {
pub fn new(expr: Expression, span: Span) -> SpannedExpression {
SpannedExpression { expr, span }
}
}
impl std::ops::Deref for SpannedExpression {
type Target = Expression;

View File

@ -102,7 +102,7 @@ impl Plugin for Average {
}
UntaggedValue::Primitive(Primitive::Bytes(bytes)) => {
let avg = *bytes as f64 / self.count as f64;
let primitive_value: UntaggedValue = Primitive::from(avg).into();
let primitive_value: UntaggedValue = UntaggedValue::bytes(avg as u64);
let tagged_value = primitive_value.into_value(inner.tag.clone());
Ok(vec![ReturnSuccess::value(tagged_value)])
}