1234567891011121314151617181920 |
- # program
- (
- (let config (DataSource 'config))
- (import agg_module '"/lib/yql/aggregate.yqls")
- (let list (AsList
- (AsStruct '('key (Uint32 '1)) '('value (Uint32 '2)))
- (AsStruct '('key (Uint32 '2)) '('value (Uint32 '3)))
- (AsStruct '('key (Uint32 '1)) '('value (Uint32 '1)))
- (AsStruct '('key (Uint32 '3)) '('value (Uint32 '9)))
- (AsStruct '('key (Uint32 '2)) '('value (Uint32 '5)))
- (AsStruct '('key (Uint32 '2)) '('value (Uint32 '7)))
- ))
- (let avg_traits (Apply (bind agg_module 'avg_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value))))
- (let res_sink (DataSink 'result))
- (let resKey (Aggregate list '('key) '('('avg_value avg_traits))))
- (let world (Write! world res_sink (Key) resKey '('('type))))
- (let world (Commit! world res_sink))
- (return world)
- )
|