More refactoring of aggregation framework

Simplify serialization of state, which will allow the approximate aggregations to be ported to the new framework as well.

Benchmark results look unchanged, as expected:

master:
                          count_agg ::   50.170 cpu ms :: in  1.5M,  12.9MB,   29.9M/s,   257MB/s :: out     1,      9B,      19/s,    179B/s
                     double_sum_agg ::   81.820 cpu ms :: in  1.5M,  12.9MB,   18.3M/s,   157MB/s :: out     1,      9B,      12/s,    109B/s
                           hash_agg ::  237.592 cpu ms :: in  1.5M,  21.5MB,   6.31M/s,  90.3MB/s :: out     3,     45B,      12/s,    189B/s
                   predicate_filter ::  107.258 cpu ms :: in  1.5M,  12.9MB,     14M/s,   120MB/s :: out 1.29M,  11.1MB,     12M/s,   103MB/s
                         raw_stream ::   51.917 cpu ms :: in  1.5M,  12.9MB,   28.9M/s,   248MB/s :: out  1.5M,  12.9MB,   28.9M/s,   248MB/s
                             top100 ::   82.947 cpu ms :: in  1.5M,  12.9MB,   18.1M/s,   155MB/s :: out   100,    900B,   1.21K/s,  10.6KB/s
             in_memory_orderby_1.5M :: 1619.428 cpu ms :: in  1.5M,  41.5MB,    926K/s,  25.6MB/s :: out  1.5M,  28.6MB,    926K/s,  17.7MB/s
                         hash_build ::  452.355 cpu ms :: in  1.5M,  25.7MB,   3.32M/s,  56.9MB/s :: out  1.5M,  25.7MB,   3.32M/s,  56.9MB/s
                          hash_join :: 1754.806 cpu ms :: in    6M,   103MB,   3.42M/s,  58.7MB/s :: out    6M,   206MB,   3.42M/s,   117MB/s
                hash_build_and_join :: 2215.103 cpu ms :: in  7.5M,   129MB,   3.39M/s,  58.1MB/s :: out    6M,   206MB,   2.71M/s,    93MB/s
                  hand_tpch_query_1 :: 4192.773 cpu ms :: in    6M,   361MB,   1.43M/s,    86MB/s :: out     4,    300B,       0/s,     71B/s
                  hand_tpch_query_6 ::  882.611 cpu ms :: in    6M,   240MB,    6.8M/s,   272MB/s :: out     1,      9B,       1/s,     10B/s
    sql_groupby_agg_with_arithmetic :: 1529.683 cpu ms :: in    6M,   137MB,   3.92M/s,  89.8MB/s :: out     2,     30B,       1/s,     19B/s
                      sql_count_agg ::   51.709 cpu ms :: in  1.5M,  12.9MB,     29M/s,   249MB/s :: out     1,      9B,      19/s,    174B/s
                 sql_double_sum_agg ::   82.969 cpu ms :: in  1.5M,  12.9MB,   18.1M/s,   155MB/s :: out     1,      9B,      12/s,    108B/s
              sql_count_with_filter ::  104.301 cpu ms :: in  1.5M,  8.58MB,   14.4M/s,  82.3MB/s :: out     1,      9B,       9/s,     86B/s
                    sql_groupby_agg ::  238.003 cpu ms :: in  1.5M,  21.5MB,    6.3M/s,  90.2MB/s :: out     3,     45B,      12/s,    189B/s
               sql_predicate_filter ::   87.894 cpu ms :: in  1.5M,  12.9MB,   17.1M/s,   146MB/s :: out 1.29M,  11.1MB,   14.7M/s,   126MB/s
                     sql_raw_stream ::   53.471 cpu ms :: in  1.5M,  12.9MB,   28.1M/s,   241MB/s :: out  1.5M,  12.9MB,   28.1M/s,   241MB/s
                        sql_top_100 ::   83.675 cpu ms :: in  1.5M,  12.9MB,   17.9M/s,   154MB/s :: out   100,    900B,    1.2K/s,  10.5KB/s
                      sql_hash_join :: 3648.007 cpu ms :: in  7.5M,   129MB,   2.06M/s,  35.3MB/s :: out    6M,   206MB,   1.65M/s,  56.5MB/s
            sql_join_with_predicate :: 1066.835 cpu ms :: in  7.5M,   116MB,   7.03M/s,   109MB/s :: out     1,      9B,       0/s,      8B/s
                  sql_varbinary_max ::  374.124 cpu ms :: in    6M,  97.3MB,     16M/s,   260MB/s :: out     1,     21B,       2/s,     56B/s
                 sql_distinct_multi ::  264.386 cpu ms :: in  1.5M,    32MB,   5.67M/s,   121MB/s :: out     5,    112B,      18/s,    423B/s
                sql_distinct_single ::  120.448 cpu ms :: in  1.5M,  12.9MB,   12.5M/s,   107MB/s :: out     1,      9B,       8/s,     74B/s
                   sql_tpch_query_1 :: 4378.585 cpu ms :: in    6M,   361MB,   1.37M/s,  82.3MB/s :: out     4,    336B,       0/s,     76B/s
                   sql_tpch_query_6 ::  857.912 cpu ms :: in    6M,   240MB,      7M/s,   280MB/s :: out     1,      9B,       1/s,     10B/s
                           sql_like :: 3290.110 cpu ms :: in    6M,   232MB,   1.82M/s,  70.4MB/s :: out 1.15M,  9.84MB,    349K/s,  2.99MB/s
                             sql_in ::  211.881 cpu ms :: in    6M,  51.5MB,   28.3M/s,   243MB/s :: out    25,    225B,     117/s,  1.04KB/s
                    sql_semijoin_in :: 2004.108 cpu ms :: in  7.5M,  64.4MB,   3.74M/s,  32.1MB/s :: out    3M,  25.8MB,    1.5M/s,  12.9MB/s
                    sql_regexp_like :: 2038.071 cpu ms :: in  1.5M,  76.6MB,    736K/s,  37.6MB/s :: out     1,      9B,       0/s,      4B/s
         sql_approx_percentile_long ::  630.795 cpu ms :: in  1.5M,  12.9MB,   2.38M/s,  20.4MB/s :: out     1,      9B,       1/s,     14B/s
                   sql_between_long ::   89.900 cpu ms :: in  1.5M,  12.9MB,   16.7M/s,   143MB/s :: out     1,      9B,      11/s,    100B/s
                 stat_long_variance ::   70.905 cpu ms :: in  1.5M,  12.9MB,   21.2M/s,   182MB/s :: out     1,      9B,      14/s,    126B/s
             stat_long_variance_pop ::   71.026 cpu ms :: in  1.5M,  12.9MB,   21.1M/s,   181MB/s :: out     1,      9B,      14/s,    126B/s
               stat_double_variance ::   68.704 cpu ms :: in  1.5M,  12.9MB,   21.8M/s,   187MB/s :: out     1,      9B,      14/s,    130B/s
           stat_double_variance_pop ::   68.713 cpu ms :: in  1.5M,  12.9MB,   21.8M/s,   187MB/s :: out     1,      9B,      14/s,    130B/s
                   stat_long_stddev ::   70.825 cpu ms :: in  1.5M,  12.9MB,   21.2M/s,   182MB/s :: out     1,      9B,      14/s,    127B/s
               stat_long_stddev_pop ::   70.617 cpu ms :: in  1.5M,  12.9MB,   21.2M/s,   182MB/s :: out     1,      9B,      14/s,    127B/s
                 stat_double_stddev ::   68.808 cpu ms :: in  1.5M,  12.9MB,   21.8M/s,   187MB/s :: out     1,      9B,      14/s,    130B/s
             stat_double_stddev_pop ::   68.520 cpu ms :: in  1.5M,  12.9MB,   21.9M/s,   188MB/s :: out     1,      9B,      14/s,    131B/s
     sql_approx_count_distinct_long ::   76.101 cpu ms :: in  1.5M,  12.9MB,   19.7M/s,   169MB/s :: out     1,      9B,      13/s,    118B/s
   sql_approx_count_distinct_double ::   78.641 cpu ms :: in  1.5M,  12.9MB,   19.1M/s,   164MB/s :: out     1,      9B,      12/s,    114B/s
sql_approx_count_distinct_varbinary ::  111.079 cpu ms :: in  1.5M,  21.5MB,   13.5M/s,   193MB/s :: out     1,      9B,       9/s,     81B/s

my branch:
                          count_agg ::   50.360 cpu ms :: in  1.5M,  12.9MB,   29.8M/s,   256MB/s :: out     1,      9B,      19/s,    178B/s
                     double_sum_agg ::   82.227 cpu ms :: in  1.5M,  12.9MB,   18.2M/s,   157MB/s :: out     1,      9B,      12/s,    109B/s
                           hash_agg ::  231.548 cpu ms :: in  1.5M,  21.5MB,   6.48M/s,  92.7MB/s :: out     3,     45B,      12/s,    194B/s
                   predicate_filter ::  113.306 cpu ms :: in  1.5M,  12.9MB,   13.2M/s,   114MB/s :: out 1.29M,  11.1MB,   11.4M/s,  97.6MB/s
                         raw_stream ::   53.801 cpu ms :: in  1.5M,  12.9MB,   27.9M/s,   239MB/s :: out  1.5M,  12.9MB,   27.9M/s,   239MB/s
                             top100 ::   93.899 cpu ms :: in  1.5M,  12.9MB,     16M/s,   137MB/s :: out   100,    900B,   1.06K/s,  9.36KB/s
             in_memory_orderby_1.5M :: 1640.738 cpu ms :: in  1.5M,  41.5MB,    914K/s,  25.3MB/s :: out  1.5M,  28.6MB,    914K/s,  17.4MB/s
                         hash_build ::  443.263 cpu ms :: in  1.5M,  25.7MB,   3.38M/s,  58.1MB/s :: out  1.5M,  25.7MB,   3.38M/s,  58.1MB/s
                          hash_join :: 1725.499 cpu ms :: in    6M,   103MB,   3.48M/s,  59.7MB/s :: out    6M,   206MB,   3.48M/s,   119MB/s
                hash_build_and_join :: 2171.789 cpu ms :: in  7.5M,   129MB,   3.45M/s,  59.3MB/s :: out    6M,   206MB,   2.76M/s,  94.9MB/s
                  hand_tpch_query_1 :: 4021.287 cpu ms :: in    6M,   361MB,   1.49M/s,  89.7MB/s :: out     4,    300B,       0/s,     74B/s
                  hand_tpch_query_6 ::  879.131 cpu ms :: in    6M,   240MB,   6.83M/s,   273MB/s :: out     1,      9B,       1/s,     10B/s
    sql_groupby_agg_with_arithmetic :: 1505.557 cpu ms :: in    6M,   137MB,   3.99M/s,  91.2MB/s :: out     2,     30B,       1/s,     19B/s
                      sql_count_agg ::   51.752 cpu ms :: in  1.5M,  12.9MB,     29M/s,   249MB/s :: out     1,      9B,      19/s,    173B/s
                 sql_double_sum_agg ::   83.592 cpu ms :: in  1.5M,  12.9MB,   17.9M/s,   154MB/s :: out     1,      9B,      11/s,    107B/s
              sql_count_with_filter ::   90.698 cpu ms :: in  1.5M,  8.58MB,   16.5M/s,  94.6MB/s :: out     1,      9B,      11/s,     99B/s
                    sql_groupby_agg ::  226.872 cpu ms :: in  1.5M,  21.5MB,   6.61M/s,  94.6MB/s :: out     3,     45B,      13/s,    198B/s
               sql_predicate_filter ::   87.474 cpu ms :: in  1.5M,  12.9MB,   17.1M/s,   147MB/s :: out 1.29M,  11.1MB,   14.7M/s,   126MB/s
                     sql_raw_stream ::   53.081 cpu ms :: in  1.5M,  12.9MB,   28.3M/s,   243MB/s :: out  1.5M,  12.9MB,   28.3M/s,   243MB/s
                        sql_top_100 ::   84.713 cpu ms :: in  1.5M,  12.9MB,   17.7M/s,   152MB/s :: out   100,    900B,   1.18K/s,  10.4KB/s
                      sql_hash_join :: 3572.770 cpu ms :: in  7.5M,   129MB,    2.1M/s,    36MB/s :: out    6M,   206MB,   1.68M/s,  57.7MB/s
            sql_join_with_predicate :: 1065.000 cpu ms :: in  7.5M,   116MB,   7.04M/s,   109MB/s :: out     1,      9B,       0/s,      8B/s
                  sql_varbinary_max ::  367.233 cpu ms :: in    6M,  97.3MB,   16.3M/s,   265MB/s :: out     1,     21B,       2/s,     57B/s
                 sql_distinct_multi ::  259.716 cpu ms :: in  1.5M,    32MB,   5.78M/s,   123MB/s :: out     5,    112B,      19/s,    431B/s
                sql_distinct_single ::  117.946 cpu ms :: in  1.5M,  12.9MB,   12.7M/s,   109MB/s :: out     1,      9B,       8/s,     76B/s
                   sql_tpch_query_1 :: 4180.204 cpu ms :: in    6M,   361MB,   1.44M/s,  86.3MB/s :: out     4,    336B,       0/s,     80B/s
                   sql_tpch_query_6 ::  828.214 cpu ms :: in    6M,   240MB,   7.25M/s,   290MB/s :: out     1,      9B,       1/s,     10B/s
                           sql_like :: 3205.596 cpu ms :: in    6M,   232MB,   1.87M/s,  72.3MB/s :: out 1.15M,  9.84MB,    358K/s,  3.07MB/s
                             sql_in ::  209.179 cpu ms :: in    6M,  51.5MB,   28.7M/s,   246MB/s :: out    25,    225B,     119/s,  1.05KB/s
                    sql_semijoin_in :: 1936.731 cpu ms :: in  7.5M,  64.4MB,   3.87M/s,  33.2MB/s :: out    3M,  25.8MB,   1.55M/s,  13.3MB/s
                    sql_regexp_like :: 1919.071 cpu ms :: in  1.5M,  76.6MB,    782K/s,  39.9MB/s :: out     1,      9B,       0/s,      4B/s
         sql_approx_percentile_long ::  598.998 cpu ms :: in  1.5M,  12.9MB,    2.5M/s,  21.5MB/s :: out     1,      9B,       1/s,     15B/s
                   sql_between_long ::   92.386 cpu ms :: in  1.5M,  12.9MB,   16.2M/s,   139MB/s :: out     1,      9B,      10/s,     97B/s
                 stat_long_variance ::   70.629 cpu ms :: in  1.5M,  12.9MB,   21.2M/s,   182MB/s :: out     1,      9B,      14/s,    127B/s
             stat_long_variance_pop ::   70.358 cpu ms :: in  1.5M,  12.9MB,   21.3M/s,   183MB/s :: out     1,      9B,      14/s,    127B/s
               stat_double_variance ::   68.072 cpu ms :: in  1.5M,  12.9MB,     22M/s,   189MB/s :: out     1,      9B,      14/s,    132B/s
           stat_double_variance_pop ::   68.484 cpu ms :: in  1.5M,  12.9MB,   21.9M/s,   188MB/s :: out     1,      9B,      14/s,    131B/s
                   stat_long_stddev ::   70.448 cpu ms :: in  1.5M,  12.9MB,   21.3M/s,   183MB/s :: out     1,      9B,      14/s,    127B/s
               stat_long_stddev_pop ::   70.352 cpu ms :: in  1.5M,  12.9MB,   21.3M/s,   183MB/s :: out     1,      9B,      14/s,    127B/s
                 stat_double_stddev ::   68.108 cpu ms :: in  1.5M,  12.9MB,     22M/s,   189MB/s :: out     1,      9B,      14/s,    132B/s
             stat_double_stddev_pop ::   68.316 cpu ms :: in  1.5M,  12.9MB,     22M/s,   188MB/s :: out     1,      9B,      14/s,    131B/s
     sql_approx_count_distinct_long ::   75.399 cpu ms :: in  1.5M,  12.9MB,   19.9M/s,   171MB/s :: out     1,      9B,      13/s,    119B/s
   sql_approx_count_distinct_double ::   78.593 cpu ms :: in  1.5M,  12.9MB,   19.1M/s,   164MB/s :: out     1,      9B,      12/s,    114B/s
sql_approx_count_distinct_varbinary ::  104.867 cpu ms :: in  1.5M,  21.5MB,   14.3M/s,   205MB/s :: out     1,      9B,       9/s,     85B/s