reduce_with_python_having.sql 353 B

1234567891011121314
  1. /* postgres can not */
  2. /* syntax version 1 */
  3. USE plato;
  4. $udfScript = @@
  5. import functools
  6. def Len(key, input):
  7. return {"count":functools.reduce(lambda x,y: x + 1, input, 0)}
  8. @@;
  9. $udf = Python::Len(Callable<(String, Stream<String>)->Struct<count:Uint32>>, $udfScript);
  10. --INSERT INTO Output
  11. REDUCE Input1 ON key USING $udf(value) HAVING count > 4;