Since you said it was possible, I kept reading over the scalding's
scanleft. I didn't find any examples on the web. This was a good
scalding exercise.
Point 1 in Moving Window Calculation (via Scalding)
<https://groups.google.com/forum/#!topic/cascading-user/CTYOjlHs6xE> helped
me realize the accumulator didn't have to be tied to the output. With that
in mind and the assumption of how
the converters and setters should be used, the rest was just matching up
the tuple types. I even figured out how to do the setter and converter
with anonymous classes.
The code is below. Is this what you had in mind?
.groupBy('field1,'field2)
{group => group.sortBy('field3)
.scanLeft(('field4,'field5') -> ('desiredfield))(0.0,0.0,0.0)(
function that takes in tuple with two doubles from tuple and updates
accumulator which is a tuple with three doubles.
)(new TupleSetter[(Double, Double, Double)]
{
override def apply(arg: (Double, Double, Double)): Tuple = { val t
= new Tuple(); t.addDouble(arg._3); t }
override def arity: Int = 1
}
, new TupleConverter[(Double, Double)]
{
override def apply(te: TupleEntry): (Double, Double) =
{
val r =te.getTuple()
(r.getDouble(0),r.getDouble(1))
}
override def arity: Int = 1
}
)
--
You received this message because you are subscribed to the Google Groups
"Scalding Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.