1234567891011121314151617181920212223 |
- # program
- (
- (let config (DataSource 'config))
- (import agg_module '"/lib/yql/aggregate.yqls")
- (let list (AsList
- (AsStruct '('key (Just (Uint32 '7))) '('value (Just (Uint32 '2))))
- (AsStruct '('key (Just (Uint32 '2))) '('value (Just (Uint32 '3))))
- (AsStruct '('key (Just (Uint32 '1))) '('value (Just (Uint32 '4))))
- (AsStruct '('key (Just (Uint32 '3))) '('value (Nothing (OptionalType (DataType 'Uint32)))))
- (AsStruct '('key (Nothing (OptionalType (DataType 'Uint32)))) '('value (Nothing (OptionalType (DataType 'Uint32)))))
- (AsStruct '('key (Just (Uint32 '2))) '('value (Nothing (OptionalType (DataType 'Uint32)))))
- (AsStruct '('key (Just (Uint32 '6))) '('value (Just (Uint32 '6))))
- (AsStruct '('key (Just (Uint32 '5))) '('value (Just (Uint32 '9))))
- ))
- (let min (Apply (bind agg_module 'min_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'key)) (Void)))
- (let max (Apply (bind agg_module 'max_by_traits_factory) (TypeOf list) (lambda '(row) (Member row 'value)) (lambda '(row) (Member row 'key)) (Void)))
- (let res_sink (DataSink 'result))
- (let resKey (Aggregate list '() '('('min min) '('max max))))
- (let world (Write! world res_sink (Key) resKey '('('type))))
- (let world (Commit! world res_sink))
- (return world)
- )
|