process_multi_out.sql 501 B

123456789101112131415161718192021222324
  1. /* syntax version 1 */
  2. /* postgres can not */
  3. $udfScript = @@
  4. def MyFunc(list):
  5. return [(int(x.key) % 2, x) for x in list]
  6. @@;
  7. $record = (SELECT TableRow() FROM plato.Input);
  8. $recordType =TypeOf(Unwrap($record));
  9. $udf = Python::MyFunc(
  10. CallableType(0,
  11. StreamType(
  12. VariantType(TupleType($recordType, $recordType))
  13. ),
  14. StreamType($recordType)),
  15. $udfScript
  16. );
  17. $i, $j = (PROCESS plato.Input USING $udf(TableRows()));
  18. select * from $i;
  19. select * from $j;