From 7471208b5c8ff6b65b644adedf7eb964da3d50ae Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Wed, 25 Aug 2021 06:51:12 -0400 Subject: [PATCH] Add `ATAN2` to `maybe_label` Signed-off-by: Levi Harrison --- promql/parser/generated_parser.y | 2 +- promql/parser/generated_parser.y.go | 317 ++++++++++++++-------------- 2 files changed, 161 insertions(+), 158 deletions(-) diff --git a/promql/parser/generated_parser.y b/promql/parser/generated_parser.y index 4380da4ee..fcf504aca 100644 --- a/promql/parser/generated_parser.y +++ b/promql/parser/generated_parser.y @@ -676,7 +676,7 @@ series_value : IDENTIFIER aggregate_op : AVG | BOTTOMK | COUNT | COUNT_VALUES | GROUP | MAX | MIN | QUANTILE | STDDEV | STDVAR | SUM | TOPK ; // inside of grouping options label names can be recognized as keywords by the lexer. This is a list of keywords that could also be a label name. -maybe_label : AVG | BOOL | BOTTOMK | BY | COUNT | COUNT_VALUES | GROUP | GROUP_LEFT | GROUP_RIGHT | IDENTIFIER | IGNORING | LAND | LOR | LUNLESS | MAX | METRIC_IDENTIFIER | MIN | OFFSET | ON | QUANTILE | STDDEV | STDVAR | SUM | TOPK | START | END; +maybe_label : AVG | BOOL | BOTTOMK | BY | COUNT | COUNT_VALUES | GROUP | GROUP_LEFT | GROUP_RIGHT | IDENTIFIER | IGNORING | LAND | LOR | LUNLESS | MAX | METRIC_IDENTIFIER | MIN | OFFSET | ON | QUANTILE | STDDEV | STDVAR | SUM | TOPK | START | END | ATAN2; unary_op : ADD | SUB; diff --git a/promql/parser/generated_parser.y.go b/promql/parser/generated_parser.y.go index a9eb6d99e..71614913a 100644 --- a/promql/parser/generated_parser.y.go +++ b/promql/parser/generated_parser.y.go @@ -283,124 +283,125 @@ var yyExca = [...]int{ 68, 154, -2, 115, -1, 190, - 12, 198, - 13, 198, - 16, 198, - 17, 198, - 23, 198, - 26, 198, - 32, 198, - 33, 198, - 36, 198, - 42, 198, - 47, 198, - 48, 198, - 49, 198, - 50, 198, - 51, 198, - 52, 198, - 53, 198, - 54, 198, - 55, 198, - 56, 198, - 57, 198, - 58, 198, - 62, 198, - 66, 198, - 68, 198, - 71, 198, - 72, 198, + 12, 199, + 13, 199, + 16, 199, + 17, 199, + 23, 199, + 26, 199, + 32, 199, + 33, 199, + 36, 199, + 42, 199, + 47, 199, + 48, 199, + 49, 199, + 50, 199, + 51, 199, + 52, 199, + 53, 199, + 54, 199, + 55, 199, + 56, 199, + 57, 199, + 58, 199, + 62, 199, + 66, 199, + 68, 199, + 71, 199, + 72, 199, -2, 0, -1, 191, - 12, 198, - 13, 198, - 16, 198, - 17, 198, - 23, 198, - 26, 198, - 32, 198, - 33, 198, - 36, 198, - 42, 198, - 47, 198, - 48, 198, - 49, 198, - 50, 198, - 51, 198, - 52, 198, - 53, 198, - 54, 198, - 55, 198, - 56, 198, - 57, 198, - 58, 198, - 62, 198, - 66, 198, - 68, 198, - 71, 198, - 72, 198, + 12, 199, + 13, 199, + 16, 199, + 17, 199, + 23, 199, + 26, 199, + 32, 199, + 33, 199, + 36, 199, + 42, 199, + 47, 199, + 48, 199, + 49, 199, + 50, 199, + 51, 199, + 52, 199, + 53, 199, + 54, 199, + 55, 199, + 56, 199, + 57, 199, + 58, 199, + 62, 199, + 66, 199, + 68, 199, + 71, 199, + 72, 199, -2, 0, -1, 212, - 19, 196, - -2, 0, - -1, 261, 19, 197, -2, 0, + -1, 262, + 19, 198, + -2, 0, } const yyPrivate = 57344 -const yyLast = 649 +const yyLast = 659 var yyAct = [...]int{ - 267, 37, 216, 142, 257, 256, 150, 113, 77, 102, - 101, 104, 148, 188, 126, 189, 270, 105, 6, 103, - 190, 191, 252, 149, 154, 251, 57, 153, 250, 121, - 51, 72, 106, 53, 22, 52, 154, 180, 165, 259, - 155, 54, 271, 145, 70, 268, 246, 153, 208, 249, - 18, 19, 155, 106, 20, 108, 144, 109, 179, 245, - 71, 107, 72, 145, 122, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 33, 7, 104, - 13, 151, 152, 110, 24, 105, 30, 162, 272, 31, - 32, 2, 3, 4, 5, 213, 143, 265, 170, 212, - 161, 48, 264, 169, 156, 34, 115, 73, 166, 160, - 163, 158, 211, 159, 168, 263, 114, 100, 262, 120, - 157, 119, 247, 81, 187, 145, 178, 145, 186, 192, + 268, 37, 216, 142, 258, 257, 150, 113, 77, 102, + 101, 104, 188, 271, 189, 190, 191, 105, 6, 126, + 218, 57, 253, 149, 154, 252, 251, 266, 180, 121, + 228, 260, 265, 272, 234, 103, 269, 144, 274, 247, + 155, 72, 213, 162, 145, 264, 212, 250, 106, 179, + 230, 231, 246, 153, 232, 108, 161, 109, 208, 211, + 106, 107, 245, 33, 122, 219, 221, 223, 224, 225, + 233, 235, 238, 239, 240, 241, 242, 143, 110, 220, + 222, 226, 227, 229, 236, 237, 115, 79, 7, 243, + 244, 2, 3, 4, 5, 104, 114, 78, 145, 263, + 170, 105, 248, 177, 156, 169, 145, 118, 166, 160, + 163, 158, 117, 159, 157, 10, 168, 100, 120, 273, + 119, 145, 81, 116, 187, 74, 178, 34, 186, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 96, 185, 99, 207, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 10, 172, 79, 173, 1, 56, 98, - 115, 9, 9, 74, 260, 78, 47, 248, 209, 210, - 114, 177, 36, 100, 51, 72, 112, 53, 22, 52, - 253, 175, 46, 254, 255, 54, 84, 258, 70, 79, - 45, 174, 176, 44, 18, 19, 93, 94, 20, 78, - 96, 125, 99, 83, 71, 76, 261, 43, 42, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 218, 8, 41, 13, 98, 35, 123, 24, 164, - 30, 228, 40, 31, 32, 234, 124, 39, 266, 273, - 118, 182, 38, 269, 49, 117, 146, 183, 184, 80, - 181, 230, 231, 153, 214, 232, 116, 274, 75, 147, - 55, 275, 154, 217, 171, 50, 219, 221, 223, 224, - 225, 233, 235, 238, 239, 240, 241, 242, 155, 111, - 220, 222, 226, 227, 229, 236, 237, 0, 0, 0, - 243, 244, 51, 72, 0, 53, 22, 52, 0, 0, - 0, 0, 0, 54, 0, 0, 70, 0, 0, 0, - 0, 0, 18, 19, 0, 0, 20, 0, 0, 0, - 0, 0, 71, 0, 0, 0, 0, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 218, - 0, 0, 13, 0, 0, 0, 24, 0, 30, 228, - 0, 31, 32, 234, 0, 0, 0, 215, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 230, - 231, 0, 0, 232, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 219, 221, 223, 224, 225, 233, - 235, 238, 239, 240, 241, 242, 0, 0, 220, 222, - 226, 227, 229, 236, 237, 0, 17, 72, 243, 244, - 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 19, 0, 0, - 20, 0, 0, 17, 33, 0, 0, 22, 0, 0, + 139, 140, 141, 182, 56, 1, 115, 9, 9, 98, + 184, 148, 172, 218, 173, 153, 114, 249, 209, 210, + 261, 8, 112, 228, 154, 35, 153, 234, 47, 46, + 254, 215, 79, 255, 256, 154, 45, 259, 44, 175, + 155, 125, 78, 230, 231, 43, 48, 232, 76, 174, + 176, 155, 73, 42, 41, 245, 262, 123, 219, 221, + 223, 224, 225, 233, 235, 238, 239, 240, 241, 242, + 164, 40, 220, 222, 226, 227, 229, 236, 237, 124, + 151, 152, 243, 244, 39, 38, 49, 146, 183, 267, + 80, 181, 214, 75, 270, 51, 72, 147, 53, 22, + 52, 55, 217, 165, 171, 50, 54, 111, 275, 70, + 0, 0, 276, 0, 0, 18, 19, 0, 0, 20, + 0, 0, 0, 0, 0, 71, 0, 0, 0, 0, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 0, 0, 0, 13, 0, 0, 0, 24, + 0, 30, 0, 0, 31, 32, 36, 100, 51, 72, + 0, 53, 22, 52, 0, 0, 0, 0, 0, 54, + 84, 0, 70, 0, 0, 0, 0, 0, 18, 19, + 93, 94, 20, 0, 96, 0, 99, 83, 71, 0, + 0, 0, 0, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 0, 0, 0, 13, 98, + 0, 0, 24, 0, 30, 0, 0, 31, 32, 51, + 72, 0, 53, 22, 52, 0, 0, 0, 0, 0, + 54, 0, 0, 70, 0, 0, 0, 0, 0, 18, + 19, 0, 0, 20, 0, 0, 17, 72, 0, 71, + 22, 0, 0, 0, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 18, 19, 0, 13, + 20, 0, 0, 24, 0, 30, 0, 0, 31, 32, 0, 11, 12, 14, 15, 16, 21, 23, 25, 26, - 27, 28, 29, 18, 19, 0, 13, 20, 0, 0, - 24, 0, 30, 0, 0, 31, 32, 0, 11, 12, + 27, 28, 29, 17, 33, 0, 13, 22, 0, 0, + 24, 0, 30, 0, 0, 31, 32, 0, 0, 0, + 0, 0, 0, 18, 19, 0, 0, 20, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 14, 15, 16, 21, 23, 25, 26, 27, 28, 29, 0, 0, 100, 13, 0, 0, 0, 24, 167, 30, 0, 0, 31, 32, 82, 84, 85, 0, 86, 87, @@ -421,42 +422,42 @@ var yyAct = [...]int{ } var yyPact = [...]int{ - 16, 68, 431, 431, 172, 404, -1000, -1000, -1000, 64, + 16, 78, 441, 441, 306, 394, -1000, -1000, -1000, 50, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, 197, -1000, 121, -1000, 504, -1000, -1000, + -1000, -1000, -1000, 190, -1000, 120, -1000, 514, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - 17, 38, -1000, 290, -1000, 290, 49, -1000, -1000, -1000, + 33, 45, -1000, 367, -1000, 367, 28, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, 168, -1000, -1000, 248, -1000, -1000, 117, -1000, - 7, -1000, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, 54, 10, - 118, 38, -51, -1000, 85, 85, 18, -1000, 478, 103, - -1000, 96, -1000, -1000, 162, -1000, -1000, 163, -1000, 35, - -1000, 246, 290, -1000, -52, -43, -1000, 290, 290, 290, - 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, - 290, 290, -1000, 34, -1000, -1000, -1000, 33, -1000, -1000, - -1000, -1000, -1000, -1000, 30, 30, 93, -1000, -1000, -1000, - -1000, 347, -1000, -1000, 39, -1000, 504, -1000, -1000, 104, - -1000, 26, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, 1, -2, -1000, -1000, -1000, 169, 85, 85, - 85, 85, 103, 103, 582, 582, 582, 563, 537, 582, - 582, 563, 103, 103, 582, 103, 169, -1000, 19, -1000, - -1000, -1000, 116, -1000, 95, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, 164, -1000, -1000, 105, -1000, -1000, 116, -1000, + 7, -1000, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, 35, 169, + 112, 45, -51, -1000, 41, 41, 243, -1000, 488, 103, + -1000, 98, -1000, -1000, 170, -1000, -1000, 85, -1000, 26, + -1000, 158, 367, -1000, -53, -48, -1000, 367, 367, 367, + 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, + 367, 367, -1000, 89, -1000, -1000, -1000, 43, -1000, -1000, + -1000, -1000, -1000, -1000, 36, 36, 40, -1000, -1000, -1000, + -1000, 171, -1000, -1000, 32, -1000, 514, -1000, -1000, 84, + -1000, 24, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, 1, -2, -1000, -1000, -1000, 303, 41, 41, + 41, 41, 103, 103, 592, 592, 592, 573, 547, 592, + 592, 573, 103, 103, 592, 103, 303, -1000, 11, -1000, + -1000, -1000, 97, -1000, 25, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, -1000, -1000, 290, -1000, -1000, -1000, - -1000, 28, 28, -8, -1000, -1000, -1000, -1000, -1000, -1000, - 23, 86, -1000, -1000, 229, -1000, 504, -1000, -1000, -1000, - 28, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, -1000, -1000, -1000, -1000, -1000, 367, -1000, -1000, + -1000, -1000, 19, 19, -11, -1000, -1000, -1000, -1000, -1000, + -1000, 14, 117, -1000, -1000, 18, -1000, 514, -1000, -1000, + -1000, 19, -1000, -1000, -1000, -1000, -1000, } var yyPgo = [...]int{ - 0, 289, 7, 275, 2, 274, 273, 168, 270, 269, - 163, 268, 232, 8, 264, 4, 5, 260, 259, 0, - 23, 257, 6, 256, 254, 252, 10, 64, 247, 246, - 1, 242, 239, 9, 237, 26, 233, 218, 217, 211, - 203, 200, 192, 176, 101, 3, 174, 167, 105, + 0, 267, 7, 265, 2, 264, 262, 164, 261, 257, + 115, 253, 181, 8, 252, 4, 5, 251, 250, 0, + 23, 248, 6, 247, 246, 245, 10, 64, 244, 239, + 1, 231, 230, 9, 217, 21, 214, 213, 205, 201, + 198, 196, 189, 188, 206, 3, 180, 165, 127, } var yyR1 = [...]int{ @@ -478,8 +479,9 @@ var yyR1 = [...]int{ 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 8, 8, 5, 5, 5, 5, 37, 20, 22, - 22, 23, 23, 19, 45, 41, 46, 46, 16, 16, + 6, 6, 8, 8, 5, 5, 5, 5, 37, 20, + 22, 22, 23, 23, 19, 45, 41, 46, 46, 16, + 16, } var yyR2 = [...]int{ @@ -501,8 +503,9 @@ var yyR2 = [...]int{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 2, 1, 1, 1, 1, 1, 0, 1, 0, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 1, 1, 1, 1, 1, 0, 1, 0, + 1, } var yyChk = [...]int{ @@ -530,10 +533,10 @@ var yyChk = [...]int{ -20, 19, 6, 2, -14, 20, -4, -6, 2, 47, 61, 48, 62, 49, 50, 51, 63, 64, 12, 65, 32, 33, 36, 52, 16, 53, 66, 67, 54, 55, - 56, 57, 58, 71, 72, 20, 7, 18, -2, 23, - 2, 24, 24, -22, -15, -15, -16, -15, -16, 20, - -46, -45, 2, 20, 7, 2, -30, -19, 17, -19, - 24, 19, 2, 20, -4, -19, + 56, 57, 58, 71, 72, 44, 20, 7, 18, -2, + 23, 2, 24, 24, -22, -15, -15, -16, -15, -16, + 20, -46, -45, 2, 20, 7, 2, -30, -19, 17, + -19, 24, 19, 2, 20, -4, -19, } var yyDef = [...]int{ @@ -542,29 +545,29 @@ var yyDef = [...]int{ 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 0, 2, -2, 3, 4, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 0, 103, 187, 0, 195, 0, 83, 84, -2, -2, + 0, 103, 188, 0, 196, 0, 83, 84, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, - 181, 182, 0, 5, 95, 0, 121, 124, 0, 129, + 182, 183, 0, 5, 95, 0, 121, 124, 0, 129, 130, 134, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 0, 0, 0, 0, 22, 23, 0, 0, 0, 60, 0, 81, 82, 0, 87, 89, 0, 94, 119, 0, 125, 0, 128, 133, 0, 42, 47, 48, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 67, 0, 69, 194, 70, 0, 72, 191, - 192, 73, 74, 188, 0, 0, 0, 80, 20, 21, + 0, 0, 67, 0, 69, 195, 70, 0, 72, 192, + 193, 73, 74, 189, 0, 0, 0, 80, 20, 21, 24, 0, 54, 25, 0, 62, 64, 66, 85, 0, - 90, 0, 93, 183, 184, 185, 186, 120, 123, 126, + 90, 0, 93, 184, 185, 186, 187, 120, 123, 126, 127, 132, 135, 137, 140, 141, 142, 26, 0, 0, -2, -2, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 68, 0, 189, - 190, 75, -2, 79, 0, 53, 56, 58, 59, 155, + 35, 36, 37, 38, 39, 40, 41, 68, 0, 190, + 191, 75, -2, 79, 0, 53, 56, 58, 59, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 61, 65, 86, 88, 91, - 92, 0, 0, 0, 45, 46, 49, 199, 50, 71, - 0, -2, 78, 51, 0, 57, 63, 136, 193, 138, - 0, 76, 77, 52, 55, 139, + 176, 177, 178, 179, 180, 181, 61, 65, 86, 88, + 91, 92, 0, 0, 0, 45, 46, 49, 200, 50, + 71, 0, -2, 78, 51, 0, 57, 63, 136, 194, + 138, 0, 76, 77, 52, 55, 139, } var yyTok1 = [...]int{ @@ -1647,7 +1650,7 @@ yydefault: } yyVAL.float = math.Float64frombits(value.StaleNaN) } - case 187: + case 188: yyDollar = yyS[yypt-1 : yypt+1] //line promql/parser/generated_parser.y:690 { @@ -1656,25 +1659,25 @@ yydefault: PosRange: yyDollar[1].item.PositionRange(), } } - case 188: + case 189: yyDollar = yyS[yypt-1 : yypt+1] //line promql/parser/generated_parser.y:698 { yyVAL.float = yylex.(*parser).number(yyDollar[1].item.Val) } - case 189: + case 190: yyDollar = yyS[yypt-2 : yypt+1] //line promql/parser/generated_parser.y:700 { yyVAL.float = yyDollar[2].float } - case 190: + case 191: yyDollar = yyS[yypt-2 : yypt+1] //line promql/parser/generated_parser.y:701 { yyVAL.float = -yyDollar[2].float } - case 193: + case 194: yyDollar = yyS[yypt-1 : yypt+1] //line promql/parser/generated_parser.y:707 { @@ -1684,7 +1687,7 @@ yydefault: yylex.(*parser).addParseErrf(yyDollar[1].item.PositionRange(), "invalid repetition in series values: %s", err) } } - case 194: + case 195: yyDollar = yyS[yypt-1 : yypt+1] //line promql/parser/generated_parser.y:717 { @@ -1694,7 +1697,7 @@ yydefault: yylex.(*parser).addParseErr(yyDollar[1].item.PositionRange(), err) } } - case 195: + case 196: yyDollar = yyS[yypt-1 : yypt+1] //line promql/parser/generated_parser.y:728 { @@ -1703,13 +1706,13 @@ yydefault: PosRange: yyDollar[1].item.PositionRange(), } } - case 196: + case 197: yyDollar = yyS[yypt-0 : yypt+1] //line promql/parser/generated_parser.y:741 { yyVAL.duration = 0 } - case 198: + case 199: yyDollar = yyS[yypt-0 : yypt+1] //line promql/parser/generated_parser.y:745 {