@@ -288,29 +288,29 @@ var AggregationTests = []AggregationTestCase{
288288 model .NewQueryResultCol ("aggr__0__parent_count" , 46 ),
289289 model .NewQueryResultCol ("aggr__0__key_0" , "Abu Dhabi" ),
290290 model .NewQueryResultCol ("aggr__0__count" , uint64 (23 )),
291- model .NewQueryResultCol ("aggr__0__1-bucket__count " , 7 ),
291+ model .NewQueryResultCol ("metric__0__1-bucket_col_0 " , 7 ),
292292 model .NewQueryResultCol ("metric__0__3-bucket_col_0" , 3 ),
293293 }},
294294 {Cols : []model.QueryResultCol {
295295 model .NewQueryResultCol ("aggr__0__parent_count" , 46 ),
296296 model .NewQueryResultCol ("aggr__0__key_0" , "Adelaide" ),
297297 model .NewQueryResultCol ("aggr__0__count" , uint64 (20 )),
298- model .NewQueryResultCol ("aggr__0__1-bucket__count " , 3 ),
298+ model .NewQueryResultCol ("metric__0__1-bucket_col_0 " , 3 ),
299299 model .NewQueryResultCol ("metric__0__3-bucket_col_0" , 2 ),
300300 }},
301301 {Cols : []model.QueryResultCol {
302302 model .NewQueryResultCol ("aggr__0__parent_count" , 46 ),
303303 model .NewQueryResultCol ("aggr__0__key_0" , "Albuquerque" ),
304304 model .NewQueryResultCol ("aggr__0__count" , uint64 (3 )),
305- model .NewQueryResultCol ("aggr__0__1-bucket__count " , 0 ),
305+ model .NewQueryResultCol ("metric__0__1-bucket_col_0 " , 0 ),
306306 model .NewQueryResultCol ("metric__0__3-bucket_col_0" , 2 ),
307307 }},
308308 },
309309 ExpectedPancakeSQL : `
310310 SELECT sum(count(*)) OVER () AS "aggr__0__parent_count",
311311 "OriginCityName" AS "aggr__0__key_0", count(*) AS "aggr__0__count",
312- countIf("Cancelled "==true) AS "metric__0__3 -bucket_col_0",
313- countIf("FlightDelay "==true) AS "aggr__0__1-bucket__count "
312+ countIf("FlightDelay "==true) AS "metric__0__1 -bucket_col_0",
313+ countIf("Cancelled "==true) AS "metric__0__3-bucket_col_0 "
314314 FROM ` + TableName + `
315315 WHERE ("timestamp">=fromUnixTimestamp64Milli(1706881636029) AND "timestamp"<=fromUnixTimestamp64Milli(1707486436029))
316316 GROUP BY "OriginCityName" AS "aggr__0__key_0"
@@ -857,11 +857,11 @@ var AggregationTests = []AggregationTestCase{
857857 }` ,
858858 ExpectedPancakeResults : []model.QueryResultRow {
859859 {Cols : []model.QueryResultCol {
860- model .NewQueryResultCol ("aggr__0-bucket__count " , uint64 (553 )),
860+ model .NewQueryResultCol ("metric__0-bucket_col_0 " , uint64 (553 )),
861861 }},
862862 },
863863 ExpectedPancakeSQL : `
864- SELECT countIf("FlightDelay"==true) AS "aggr__0-bucket__count "
864+ SELECT countIf("FlightDelay"==true) AS "metric__0-bucket_col_0 "
865865 FROM ` + TableName + `
866866 WHERE ("timestamp">=fromUnixTimestamp64Milli(1706881636029) AND "timestamp"<=fromUnixTimestamp64Milli(1707486436029))` ,
867867 },
@@ -3918,7 +3918,7 @@ var AggregationTests = []AggregationTestCase{
39183918 }},
39193919 },
39203920 ExpectedAdditionalPancakeResults : [][]model.QueryResultRow {
3921- {
3921+ { // not all columns, but it doesn't matter, we don't need them in this testcase, it seems
39223922 {Cols : []model.QueryResultCol {
39233923 model .NewQueryResultCol ("aggr__sample__count" , int64 (1634 )),
39243924 model .NewQueryResultCol ("aggr__sample__bytes_gauge_top__parent_count" , int64 (1634 )),
@@ -4036,22 +4036,104 @@ var AggregationTests = []AggregationTestCase{
40364036 FROM (
40374037 SELECT "bytes_gauge"
40384038 FROM __quesma_table_name
4039- WHERE ("timestamp">=fromUnixTimestamp64Milli(1709932426749) AND "timestamp"<=fromUnixTimestamp64Milli(1711228426749))
4039+ WHERE ("timestamp">=fromUnixTimestamp64Milli(1709932426749) AND "timestamp"<=
4040+ fromUnixTimestamp64Milli(1711228426749))
40404041 LIMIT 20000)` ,
4041- ExpectedAdditionalPancakeSQLs : []string {
4042- `SELECT sum(count(*)) OVER () AS "aggr__sample__count",
4042+ ExpectedAdditionalPancakeSQLs : []string {`
4043+ SELECT sum(count(*)) OVER () AS "aggr__sample__count",
4044+ quantilesMerge(0.050000)(quantilesState(0.050000)("bytes_gauge")) OVER () AS
4045+ "metric__sample__bytes_gauge_percentiles_col_0",
4046+ quantilesMerge(0.100000)(quantilesState(0.100000)("bytes_gauge")) OVER () AS
4047+ "metric__sample__bytes_gauge_percentiles_col_1",
4048+ quantilesMerge(0.150000)(quantilesState(0.150000)("bytes_gauge")) OVER () AS
4049+ "metric__sample__bytes_gauge_percentiles_col_2",
4050+ quantilesMerge(0.200000)(quantilesState(0.200000)("bytes_gauge")) OVER () AS
4051+ "metric__sample__bytes_gauge_percentiles_col_3",
4052+ quantilesMerge(0.250000)(quantilesState(0.250000)("bytes_gauge")) OVER () AS
4053+ "metric__sample__bytes_gauge_percentiles_col_4",
4054+ quantilesMerge(0.300000)(quantilesState(0.300000)("bytes_gauge")) OVER () AS
4055+ "metric__sample__bytes_gauge_percentiles_col_5",
4056+ quantilesMerge(0.350000)(quantilesState(0.350000)("bytes_gauge")) OVER () AS
4057+ "metric__sample__bytes_gauge_percentiles_col_6",
4058+ quantilesMerge(0.400000)(quantilesState(0.400000)("bytes_gauge")) OVER () AS
4059+ "metric__sample__bytes_gauge_percentiles_col_7",
4060+ quantilesMerge(0.450000)(quantilesState(0.450000)("bytes_gauge")) OVER () AS
4061+ "metric__sample__bytes_gauge_percentiles_col_8",
4062+ quantilesMerge(0.500000)(quantilesState(0.500000)("bytes_gauge")) OVER () AS
4063+ "metric__sample__bytes_gauge_percentiles_col_9",
4064+ quantilesMerge(0.550000)(quantilesState(0.550000)("bytes_gauge")) OVER () AS
4065+ "metric__sample__bytes_gauge_percentiles_col_10",
4066+ quantilesMerge(0.600000)(quantilesState(0.600000)("bytes_gauge")) OVER () AS
4067+ "metric__sample__bytes_gauge_percentiles_col_11",
4068+ quantilesMerge(0.650000)(quantilesState(0.650000)("bytes_gauge")) OVER () AS
4069+ "metric__sample__bytes_gauge_percentiles_col_12",
4070+ quantilesMerge(0.700000)(quantilesState(0.700000)("bytes_gauge")) OVER () AS
4071+ "metric__sample__bytes_gauge_percentiles_col_13",
4072+ quantilesMerge(0.750000)(quantilesState(0.750000)("bytes_gauge")) OVER () AS
4073+ "metric__sample__bytes_gauge_percentiles_col_14",
4074+ quantilesMerge(0.800000)(quantilesState(0.800000)("bytes_gauge")) OVER () AS
4075+ "metric__sample__bytes_gauge_percentiles_col_15",
4076+ quantilesMerge(0.850000)(quantilesState(0.850000)("bytes_gauge")) OVER () AS
4077+ "metric__sample__bytes_gauge_percentiles_col_16",
4078+ quantilesMerge(0.900000)(quantilesState(0.900000)("bytes_gauge")) OVER () AS
4079+ "metric__sample__bytes_gauge_percentiles_col_17",
4080+ quantilesMerge(0.950000)(quantilesState(0.950000)("bytes_gauge")) OVER () AS
4081+ "metric__sample__bytes_gauge_percentiles_col_18",
4082+ quantilesMerge(0.999999)(quantilesState(0.999999)("bytes_gauge")) OVER () AS
4083+ "metric__sample__bytes_gauge_percentiles_col_19",
4084+ quantilesMerge(0.050000)(quantilesState(0.050000)("bytes_gauge")) OVER () AS
4085+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_0",
4086+ quantilesMerge(0.100000)(quantilesState(0.100000)("bytes_gauge")) OVER () AS
4087+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_1",
4088+ quantilesMerge(0.150000)(quantilesState(0.150000)("bytes_gauge")) OVER () AS
4089+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_2",
4090+ quantilesMerge(0.200000)(quantilesState(0.200000)("bytes_gauge")) OVER () AS
4091+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_3",
4092+ quantilesMerge(0.250000)(quantilesState(0.250000)("bytes_gauge")) OVER () AS
4093+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_4",
4094+ quantilesMerge(0.300000)(quantilesState(0.300000)("bytes_gauge")) OVER () AS
4095+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_5",
4096+ quantilesMerge(0.350000)(quantilesState(0.350000)("bytes_gauge")) OVER () AS
4097+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_6",
4098+ quantilesMerge(0.400000)(quantilesState(0.400000)("bytes_gauge")) OVER () AS
4099+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_7",
4100+ quantilesMerge(0.450000)(quantilesState(0.450000)("bytes_gauge")) OVER () AS
4101+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_8",
4102+ quantilesMerge(0.500000)(quantilesState(0.500000)("bytes_gauge")) OVER () AS
4103+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_9",
4104+ quantilesMerge(0.550000)(quantilesState(0.550000)("bytes_gauge")) OVER () AS
4105+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_10",
4106+ quantilesMerge(0.600000)(quantilesState(0.600000)("bytes_gauge")) OVER () AS
4107+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_11",
4108+ quantilesMerge(0.650000)(quantilesState(0.650000)("bytes_gauge")) OVER () AS
4109+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_12",
4110+ quantilesMerge(0.700000)(quantilesState(0.700000)("bytes_gauge")) OVER () AS
4111+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_13",
4112+ quantilesMerge(0.750000)(quantilesState(0.750000)("bytes_gauge")) OVER () AS
4113+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_14",
4114+ quantilesMerge(0.800000)(quantilesState(0.800000)("bytes_gauge")) OVER () AS
4115+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_15",
4116+ quantilesMerge(0.850000)(quantilesState(0.850000)("bytes_gauge")) OVER () AS
4117+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_16",
4118+ quantilesMerge(0.900000)(quantilesState(0.900000)("bytes_gauge")) OVER () AS
4119+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_17",
4120+ quantilesMerge(0.950000)(quantilesState(0.950000)("bytes_gauge")) OVER () AS
4121+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_18",
4122+ quantilesMerge(0.999999)(quantilesState(0.999999)("bytes_gauge")) OVER () AS
4123+ "metric__sample__bytes_gauge_percentiles_keyed_true_col_19",
40434124 sum(count(*)) OVER () AS "aggr__sample__bytes_gauge_top__parent_count",
40444125 "bytes_gauge" AS "aggr__sample__bytes_gauge_top__key_0",
40454126 count(*) AS "aggr__sample__bytes_gauge_top__count"
40464127 FROM (
40474128 SELECT "bytes_gauge"
40484129 FROM __quesma_table_name
4049- WHERE ("timestamp">=fromUnixTimestamp64Milli(1709932426749) AND "timestamp"<=fromUnixTimestamp64Milli(1711228426749))
4130+ WHERE ("timestamp">=fromUnixTimestamp64Milli(1709932426749) AND "timestamp"<=
4131+ fromUnixTimestamp64Milli(1711228426749))
40504132 LIMIT 20000)
40514133 GROUP BY "bytes_gauge" AS "aggr__sample__bytes_gauge_top__key_0"
40524134 ORDER BY "aggr__sample__bytes_gauge_top__count" DESC,
4053- "aggr__sample__bytes_gauge_top__key_0" ASC
4054- LIMIT 11` ,
4135+ "aggr__sample__bytes_gauge_top__key_0" ASC
4136+ LIMIT 11` ,
40554137 },
40564138 },
40574139 { // [21]
@@ -5233,29 +5315,29 @@ var AggregationTests = []AggregationTestCase{
52335315 model .NewQueryResultCol ("aggr__0__parent_count" , uint64 (14 )),
52345316 model .NewQueryResultCol ("aggr__0__key_0" , "Albuquerque" ),
52355317 model .NewQueryResultCol ("aggr__0__count" , uint64 (4 )),
5236- model .NewQueryResultCol ("aggr__0__1-bucket__count " , uint64 (1 )),
5318+ model .NewQueryResultCol ("metric__0__1-bucket_col_0 " , uint64 (1 )),
52375319 model .NewQueryResultCol ("metric__0__3-bucket_col_0" , uint64 (2 )),
52385320 }},
52395321 {Cols : []model.QueryResultCol {
52405322 model .NewQueryResultCol ("aggr__0__parent_count" , uint64 (14 )),
52415323 model .NewQueryResultCol ("aggr__0__key_0" , "Atlanta" ),
52425324 model .NewQueryResultCol ("aggr__0__count" , uint64 (5 )),
5243- model .NewQueryResultCol ("aggr__0__1-bucket__count " , uint64 (0 )),
5325+ model .NewQueryResultCol ("metric__0__1-bucket_col_0 " , uint64 (0 )),
52445326 model .NewQueryResultCol ("metric__0__3-bucket_col_0" , uint64 (0 )),
52455327 }},
52465328 {Cols : []model.QueryResultCol {
52475329 model .NewQueryResultCol ("aggr__0__parent_count" , uint64 (14 )),
52485330 model .NewQueryResultCol ("aggr__0__key_0" , "Baltimore" ),
52495331 model .NewQueryResultCol ("aggr__0__count" , uint64 (5 )),
5250- model .NewQueryResultCol ("aggr__0__1-bucket__count " , uint64 (2 )),
5332+ model .NewQueryResultCol ("metric__0__1-bucket_col_0 " , uint64 (2 )),
52515333 model .NewQueryResultCol ("metric__0__3-bucket_col_0" , uint64 (0 )),
52525334 }},
52535335 },
52545336 ExpectedPancakeSQL : `
52555337 SELECT sum(count(*)) OVER () AS "aggr__0__parent_count",
52565338 "OriginCityName" AS "aggr__0__key_0", count(*) AS "aggr__0__count",
5257- countIf("Cancelled "==true) AS "metric__0__3 -bucket_col_0",
5258- countIf("FlightDelay "==true) AS "aggr__0__1-bucket__count "
5339+ countIf("FlightDelay "==true) AS "metric__0__1 -bucket_col_0",
5340+ countIf("Cancelled "==true) AS "metric__0__3-bucket_col_0 "
52595341 FROM ` + TableName + `
52605342 GROUP BY "OriginCityName" AS "aggr__0__key_0"
52615343 ORDER BY "aggr__0__key_0" ASC
0 commit comments