LengthOfTableInsideMap.yql 740 B

123456789101112131415161718192021222324
  1. (
  2. #comment
  3. (let mr_source (DataSource 'yt 'plato))
  4. (let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
  5. (let world (Left! x))
  6. (let table1 (Right! x))
  7. (let x (Read! world mr_source (Key '('table (String 'Input2))) '('key 'subkey 'value) '()))
  8. (let world (Left! x))
  9. (let table2 (Right! x))
  10. (let table3 (Map table1 (lambda '(item) (block '(
  11. (let s (AsStruct
  12. '('key (Member item 'key))
  13. '('subkey (ToString (Length table2)))
  14. '('value (Member item 'value))
  15. ))
  16. (return s)
  17. )))))
  18. (let mr_sink (DataSink 'yt (quote plato)))
  19. (let world (Write! world mr_sink (Key '('table (String 'Output))) table3 '('('mode 'append))))
  20. (let world (Commit! world mr_sink))
  21. (return world)
  22. )