logariphmic_histogram.sql 575 B

123456789101112131415161718
  1. /* syntax version 1 */
  2. /* postgres can not */
  3. $t = AsList(AsStruct(1 as a),AsStruct(2 as a));
  4. $f = AGGREGATION_FACTORY("logarithmichistogram");
  5. select Yql::Aggregate($t, AsTuple(), AsTuple(AsTuple(AsAtom("res"), $f(
  6. ListItemType(TypeOf($t)), ($z)->{return $z.a}))));
  7. $f = AGGREGATION_FACTORY("logarithmichistogram", 10, 0.01, 1000.0);
  8. select Yql::Aggregate($t, AsTuple(), AsTuple(AsTuple(AsAtom("res"), $f(
  9. ListItemType(TypeOf($t)), ($z)->{return $z.a}))));
  10. use plato;
  11. insert into @a select a as aa from as_table($t);
  12. commit;
  13. select AGGREGATE_BY(aa,$f) from @a;