From 3e53b53303bb015cd8fa5b36b83f0edc0068a131 Mon Sep 17 00:00:00 2001 From: tison Date: Sun, 26 May 2024 22:43:59 +0800 Subject: [PATCH 1/4] build(deps): upgrade promql-parser to 0.4 Signed-off-by: tison --- Cargo.toml | 1 + src/promql/Cargo.toml | 2 +- src/query/Cargo.toml | 2 +- src/servers/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cd75659d21b6..17ccf1fd93f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -140,6 +140,7 @@ parquet = { version = "51.0.0", default-features = false, features = ["arrow", " paste = "1.0" pin-project = "1.0" prometheus = { version = "0.13.3", features = ["process"] } +promql-parser = { version = "0.4" } prost = "0.12" raft-engine = { version = "0.4.1", default-features = false } rand = "0.8" diff --git a/src/promql/Cargo.toml b/src/promql/Cargo.toml index 893b8b24c372..0bc9d6187485 100644 --- a/src/promql/Cargo.toml +++ b/src/promql/Cargo.toml @@ -28,7 +28,7 @@ greptime-proto.workspace = true itertools.workspace = true lazy_static.workspace = true prometheus.workspace = true -promql-parser = "0.1.1" +promql-parser.workspace = true prost.workspace = true session.workspace = true snafu.workspace = true diff --git a/src/query/Cargo.toml b/src/query/Cargo.toml index 78e435861470..23fe20944c71 100644 --- a/src/query/Cargo.toml +++ b/src/query/Cargo.toml @@ -48,7 +48,7 @@ object-store.workspace = true once_cell.workspace = true prometheus.workspace = true promql.workspace = true -promql-parser = "0.1.1" +promql-parser.workspace = true regex.workspace = true session.workspace = true snafu.workspace = true diff --git a/src/servers/Cargo.toml b/src/servers/Cargo.toml index 27920758e719..b6dc9c2cd508 100644 --- a/src/servers/Cargo.toml +++ b/src/servers/Cargo.toml @@ -76,7 +76,7 @@ pprof = { version = "0.13", features = [ "protobuf", ], optional = true } prometheus.workspace = true -promql-parser = "0.1.1" +promql-parser.workspace = true prost.workspace = true query.workspace = true rand.workspace = true From d1e14af3742f415ca67e0bab39433197fa4a8493 Mon Sep 17 00:00:00 2001 From: tison Date: Sun, 26 May 2024 22:46:00 +0800 Subject: [PATCH 2/4] lock Signed-off-by: tison --- Cargo.lock | 197 +++++++++++++++++++++-------------------------------- 1 file changed, 79 insertions(+), 118 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3f55db18cc91..d230f05a0ff0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,7 +35,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cipher", "cpufeatures", ] @@ -57,7 +57,7 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "const-random", "getrandom", "once_cell", @@ -82,7 +82,7 @@ checksum = "befdff0b4683a0824fc8719ce639a252d9d62cd89c8d0004c39e2417128c1eb8" dependencies = [ "axum", "bytes", - "cfg-if 1.0.0", + "cfg-if", "http", "indexmap 1.9.3", "schemars", @@ -834,7 +834,7 @@ checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object", @@ -1009,7 +1009,7 @@ dependencies = [ "arrayref", "arrayvec", "cc", - "cfg-if 1.0.0", + "cfg-if", "constant_time_eq", ] @@ -1339,12 +1339,6 @@ dependencies = [ "nom", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -1359,11 +1353,11 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "cfgrammar" -version = "0.12.0" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf74ea341ae8905eac9a234b6a5a845e118c25bbbdecf85ec77431a8b3bfa0be" +checksum = "163348850b1cd34fa99ef1592b5d598ea7e6752f18aff2125b67537e887edb36" dependencies = [ - "indexmap 1.9.3", + "indexmap 2.2.6", "lazy_static", "num-traits", "regex", @@ -2309,7 +2303,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -2351,7 +2345,7 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -2581,7 +2575,7 @@ version = "5.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "hashbrown 0.14.5", "lock_api", "once_cell", @@ -3425,7 +3419,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -3472,7 +3466,7 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53ecafc952c4528d9b51a458d1a8904b81783feff9fde08ab6ed2545ff396872" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "socket2 0.4.10", "winapi", @@ -3535,7 +3529,7 @@ version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -3556,26 +3550,6 @@ dependencies = [ "syn 2.0.61", ] -[[package]] -name = "enum-iterator" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd242f399be1da0a5354aa462d57b4ab2b4ee0683cc552f7c007d2d12d36e94" -dependencies = [ - "enum-iterator-derive", -] - -[[package]] -name = "enum-iterator-derive" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.61", -] - [[package]] name = "enum_dispatch" version = "0.3.13" @@ -3717,7 +3691,7 @@ version = "3.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "rustix", "windows-sys 0.48.0", ] @@ -3758,7 +3732,7 @@ version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall 0.4.1", "windows-sys 0.52.0", @@ -4186,25 +4160,13 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi", "wasm-bindgen", ] -[[package]] -name = "getset" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "gimli" version = "0.28.1" @@ -4275,7 +4237,7 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crunchy", "num-traits", ] @@ -4854,7 +4816,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -4955,7 +4917,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" dependencies = [ "cesu8", - "cfg-if 1.0.0", + "cfg-if", "combine", "jni-sys", "log", @@ -5207,7 +5169,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] @@ -5217,7 +5179,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "windows-targets 0.52.5", ] @@ -5325,31 +5287,33 @@ dependencies = [ [[package]] name = "lrlex" -version = "0.12.0" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22b832738fbfa58ad036580929e973b3b6bd31c6d6c7f18f6b5ea7b626675c85" +checksum = "77ff18e1bd3ed77d7bc2800a0f8b0e922a3c7ba525505be8bab9cf45dfc4984b" dependencies = [ + "cfgrammar", "getopts", "lazy_static", "lrpar", "num-traits", + "quote", "regex", + "regex-syntax 0.8.3", "serde", - "try_from", "vergen", ] [[package]] name = "lrpar" -version = "0.12.0" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f270b952b07995fe874b10a5ed7dd28c80aa2130e37a7de7ed667d034e0a521" +checksum = "efea5a41b9988b5ae41ea9b2375a52cfa0e483f0210357209caa8d361a24a368" dependencies = [ "bincode", "cactus", "cfgrammar", "filetime", - "indexmap 1.9.3", + "indexmap 2.2.6", "lazy_static", "lrtable", "num-traits", @@ -5363,16 +5327,15 @@ dependencies = [ [[package]] name = "lrtable" -version = "0.12.0" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a854115c6a10772ac154261592b082436abc869c812575cadcf9d7ceda8eff0b" +checksum = "ff5668c3bfd279ed24d5b0d24568c48dc993f9beabd51f74d1865a78c1d206ab" dependencies = [ "cfgrammar", "fnv", "num-traits", "serde", "sparsevec", - "static_assertions", "vob", ] @@ -5512,7 +5475,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "digest", ] @@ -5837,7 +5800,7 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c84490118f2ee2d74570d114f3d0493cbf02790df303d2707606c3e14e07c96" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "downcast", "fragile", "lazy_static", @@ -5852,7 +5815,7 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22ce75669015c4f47b289fd4d4f56e894e4c96003ffdf3ac51313126f94c6cbb" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "proc-macro2", "quote", "syn 1.0.109", @@ -6119,7 +6082,7 @@ checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset 0.6.5", "pin-utils", @@ -6132,7 +6095,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset 0.7.1", "pin-utils", @@ -6145,7 +6108,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ "bitflags 2.5.0", - "cfg-if 1.0.0", + "cfg-if", "cfg_aliases", "libc", "memoffset 0.9.1", @@ -6354,6 +6317,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + [[package]] name = "number_prefix" version = "0.4.0" @@ -6850,7 +6822,7 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall 0.2.16", @@ -6865,7 +6837,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "backtrace", - "cfg-if 1.0.0", + "cfg-if", "libc", "petgraph", "redox_syscall 0.5.1", @@ -7337,7 +7309,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef5c97c51bd34c7e742402e216abdeb44d415fbe6ae41d56b114723e953711cb" dependencies = [ "backtrace", - "cfg-if 1.0.0", + "cfg-if", "findshlibs", "inferno", "libc", @@ -7519,7 +7491,7 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d33c28a30771f7f96db69893f78b857f7450d7e0237e9c8fc6427a81bae7ed1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fnv", "lazy_static", "libc", @@ -7577,9 +7549,9 @@ dependencies = [ [[package]] name = "promql-parser" -version = "0.1.4" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96ad54e4f5d76ea28a131b1a09aaa6e58708eae98510f63ccec4ce7514bf30d" +checksum = "007a331efb31f6ddb644590ef22359c9469784931162aad92599e34bcfa66583" dependencies = [ "cfgrammar", "lazy_static", @@ -7794,7 +7766,7 @@ version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53bdbb96d49157e65d45cc287af5f32ffadd5f4761438b527b055fb0d4bb8233" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "indoc", "libc", "memoffset 0.9.1", @@ -8363,7 +8335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", - "cfg-if 1.0.0", + "cfg-if", "getrandom", "libc", "spin 0.9.8", @@ -8494,7 +8466,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290ca1a1c8ca7edb7c3283bd44dc35dd54fdec6253a3912e201ba1072018fca8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "proc-macro2", "quote", "rustc_version", @@ -8554,7 +8526,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ordered-multimap 0.4.3", ] @@ -8564,7 +8536,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e0698206bcb8882bf2a9ecb4c1e7785db57ff052297085a6efd4fe42302068a" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ordered-multimap 0.7.3", ] @@ -8797,7 +8769,7 @@ dependencies = [ "ascii", "bitflags 1.3.2", "bstr", - "cfg-if 1.0.0", + "cfg-if", "hexf-parse", "itertools 0.10.5", "lexical-parse-float", @@ -8918,7 +8890,7 @@ dependencies = [ "ascii", "base64 0.13.1", "blake2", - "cfg-if 1.0.0", + "cfg-if", "crc32fast", "crossbeam-utils", "csv-core", @@ -8986,7 +8958,7 @@ dependencies = [ "bitflags 1.3.2", "bstr", "caseless", - "cfg-if 1.0.0", + "cfg-if", "chrono", "crossbeam-utils", "exitcode", @@ -9059,7 +9031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1e83c32c3f3c33b08496e0d1df9ea8c64d39adb8eb36a1ebb1440c690697aef" dependencies = [ "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "clipboard-win", "dirs-next", "fd-lock", @@ -9082,7 +9054,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfc8644681285d1fb67a467fb3021bfea306b99b4146b166a1fe3ada965eece" dependencies = [ "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "clipboard-win", "dirs-next", "fd-lock", @@ -9627,7 +9599,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -9638,7 +9610,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -9649,7 +9621,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -9840,9 +9812,9 @@ dependencies = [ [[package]] name = "sparsevec" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928d1ef5df00aec8c5643c2ac37db4dd282763013c0fcc81efbb8e13db8dd8ec" +checksum = "35df5d2e580b29f3f7ec5b4ed49b0ab3acf7f3624122b3e823cafb9630f293b8" dependencies = [ "num-traits", "packedvec", @@ -10485,7 +10457,7 @@ version = "0.30.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "732ffa00f53e6b2af46208fba5718d9662a421049204e156328b66791ffa15ae" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "core-foundation-sys", "libc", "ntapi", @@ -10584,7 +10556,7 @@ version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "rustix", "windows-sys 0.52.0", @@ -10789,7 +10761,7 @@ version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -10843,7 +10815,9 @@ checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "libc", "num-conv", + "num_threads", "powerfmt", "serde", "time-core", @@ -11562,22 +11536,13 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "try_from" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "283d3b89e1368717881a9d51dad843cc435380d8109c9e47d38780a324698d8b" -dependencies = [ - "cfg-if 0.1.10", -] - [[package]] name = "twox-hash" version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "rand", "static_assertions", ] @@ -12010,16 +11975,12 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "vergen" -version = "7.5.1" +version = "8.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f21b881cd6636ece9735721cf03c1fe1e774fe258683d084bb2812ab67435749" +checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525" dependencies = [ "anyhow", - "cfg-if 1.0.0", - "enum-iterator", - "getset", "rustversion", - "thiserror", "time", ] @@ -12083,7 +12044,7 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -12108,7 +12069,7 @@ version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -12598,7 +12559,7 @@ version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "windows-sys 0.48.0", ] From 4182d103590cabae034075219b6041a63f857be2 Mon Sep 17 00:00:00 2001 From: tison Date: Sun, 26 May 2024 23:35:06 +0800 Subject: [PATCH 3/4] catch up upgrades Signed-off-by: tison --- src/promql/src/error.rs | 5 +++-- src/promql/src/planner.rs | 19 +++++++++------- src/query/src/parser.rs | 8 +++---- src/servers/src/grpc/prom_query_gateway.rs | 2 +- src/servers/src/http/prometheus.rs | 25 +++++++++++++++++----- src/servers/src/http/prometheus_resp.rs | 2 +- 6 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/promql/src/error.rs b/src/promql/src/error.rs index 4cc4c47a2e75..a9598904f036 100644 --- a/src/promql/src/error.rs +++ b/src/promql/src/error.rs @@ -18,7 +18,8 @@ use common_error::ext::ErrorExt; use common_error::status_code::StatusCode; use common_macro::stack_trace_debug; use datafusion::error::DataFusionError; -use promql_parser::parser::{Expr as PromExpr, TokenType, VectorMatchCardinality}; +use promql_parser::parser::token::TokenType; +use promql_parser::parser::{Expr as PromExpr, VectorMatchCardinality}; use snafu::{Location, Snafu}; #[derive(Snafu)] @@ -49,7 +50,7 @@ pub enum Error { #[snafu(display("Internal error during building DataFusion plan"))] DataFusionPlanning { #[snafu(source)] - error: datafusion::error::DataFusionError, + error: DataFusionError, #[snafu(implicit)] location: Location, }, diff --git a/src/promql/src/planner.rs b/src/promql/src/planner.rs index 9fe5d3019b44..7e47b8702157 100644 --- a/src/promql/src/planner.rs +++ b/src/promql/src/planner.rs @@ -39,10 +39,11 @@ use datatypes::arrow::datatypes::{DataType as ArrowDataType, TimeUnit as ArrowTi use datatypes::data_type::ConcreteDataType; use itertools::Itertools; use promql_parser::label::{MatchOp, Matcher, Matchers, METRIC_NAME}; +use promql_parser::parser::token::TokenType; use promql_parser::parser::{ token, AggregateExpr, BinModifier, BinaryExpr as PromBinaryExpr, Call, EvalStmt, Expr as PromExpr, Function, FunctionArgs as PromFunctionArgs, LabelModifier, MatrixSelector, - NumberLiteral, Offset, ParenExpr, StringLiteral, SubqueryExpr, TokenType, UnaryExpr, + NumberLiteral, Offset, ParenExpr, StringLiteral, SubqueryExpr, UnaryExpr, VectorMatchCardinality, VectorSelector, }; use snafu::{ensure, OptionExt, ResultExt}; @@ -606,15 +607,14 @@ impl PromPlanner { if let Some(name) = name.clone() { metric_name = Some(name); ensure!( - label_matchers.find_matcher(METRIC_NAME).is_none(), + label_matchers.find_matchers(METRIC_NAME).is_empty(), MultipleMetricMatchersSnafu ); } else { - metric_name = Some( - label_matchers - .find_matcher(METRIC_NAME) - .context(NoMetricMatcherSnafu)?, - ); + let mut matches = label_matchers.find_matchers(METRIC_NAME); + ensure!(!matches.is_empty(), NoMetricMatcherSnafu); + ensure!(matches.len() == 1, MultipleMetricMatchersSnafu); + metric_name = matches.pop().map(|m| m.value); } self.ctx.table_name = metric_name; @@ -641,7 +641,10 @@ impl PromPlanner { } } let matchers = matchers.into_iter().collect(); - Ok(Matchers { matchers }) + Ok(Matchers { + matchers, + or_matchers: vec![], + }) } async fn selector_to_series_normalize_plan( diff --git a/src/query/src/parser.rs b/src/query/src/parser.rs index 859ae924e747..b99bb6953e7a 100644 --- a/src/query/src/parser.rs +++ b/src/query/src/parser.rs @@ -22,8 +22,9 @@ use common_error::ext::{BoxedError, PlainError}; use common_error::status_code::StatusCode; use common_telemetry::tracing; use promql_parser::parser::ast::{Extension as NodeExtension, ExtensionExpr}; +use promql_parser::parser::value::ValueType; use promql_parser::parser::Expr::Extension; -use promql_parser::parser::{EvalStmt, Expr, ValueType}; +use promql_parser::parser::{EvalStmt, Expr}; use session::context::QueryContextRef; use snafu::{OptionExt, ResultExt}; use sql::dialect::GreptimeDbDialect; @@ -372,8 +373,7 @@ mod test { Promql(EvalStmt { \ expr: VectorSelector(VectorSelector { \ name: Some(\"http_request\"), \ - matchers: Matchers { \ - matchers: [] }, \ + matchers: Matchers { matchers: [], or_matchers: [] }, \ offset: None, at: None }), \ start: SystemTime { tv_sec: 1644772440, tv_nsec: 0 }, \ end: SystemTime { tv_sec: 1676308440, tv_nsec: 0 }, \ @@ -389,7 +389,7 @@ mod test { Promql(EvalStmt { \ expr: VectorSelector(VectorSelector { \ name: Some(\"http_request\"), \ - matchers: Matchers { matchers: [] }, \ + matchers: Matchers { matchers: [], or_matchers: [] }, \ offset: None, at: None }), \ start: SystemTime { intervals: 132892460400000000 }, \ end: SystemTime { intervals: 133207820400000000 }, \ diff --git a/src/servers/src/grpc/prom_query_gateway.rs b/src/servers/src/grpc/prom_query_gateway.rs index ebd1a6d2556b..e2aeec897f7b 100644 --- a/src/servers/src/grpc/prom_query_gateway.rs +++ b/src/servers/src/grpc/prom_query_gateway.rs @@ -25,7 +25,7 @@ use auth::UserProviderRef; use common_error::ext::ErrorExt; use common_error::status_code::StatusCode; use common_time::util::current_time_rfc3339; -use promql_parser::parser::ValueType; +use promql_parser::parser::value::ValueType; use query::parser::PromQuery; use session::context::QueryContext; use snafu::OptionExt; diff --git a/src/servers/src/http/prometheus.rs b/src/servers/src/http/prometheus.rs index 4a45adcfe056..210e180a28b5 100644 --- a/src/servers/src/http/prometheus.rs +++ b/src/servers/src/http/prometheus.rs @@ -32,9 +32,10 @@ use datatypes::scalars::ScalarVector; use datatypes::vectors::{Float64Vector, StringVector}; use futures::StreamExt; use promql_parser::label::METRIC_NAME; +use promql_parser::parser::value::ValueType; use promql_parser::parser::{ AggregateExpr, BinaryExpr, Call, Expr as PromqlExpr, MatrixSelector, ParenExpr, SubqueryExpr, - UnaryExpr, ValueType, VectorSelector, + UnaryExpr, VectorSelector, }; use query::parser::{PromQuery, DEFAULT_LOOKBACK_STRING}; use schemars::JsonSchema; @@ -642,11 +643,19 @@ fn promql_expr_to_metric_name(expr: &PromqlExpr) -> Option { PromqlExpr::StringLiteral(_) => Some(String::new()), PromqlExpr::Extension(_) => None, PromqlExpr::VectorSelector(VectorSelector { name, matchers, .. }) => { - name.clone().or(matchers.find_matcher(METRIC_NAME)) + name.clone().or(matchers + .find_matchers(METRIC_NAME) + .into_iter() + .next() + .map(|m| m.value)) } PromqlExpr::MatrixSelector(MatrixSelector { vs, .. }) => { let VectorSelector { name, matchers, .. } = vs; - name.clone().or(matchers.find_matcher(METRIC_NAME)) + name.clone().or(matchers + .find_matchers(METRIC_NAME) + .into_iter() + .next() + .map(|m| m.value)) } PromqlExpr::Call(Call { args, .. }) => { args.args.iter().find_map(|e| promql_expr_to_metric_name(e)) @@ -880,12 +889,18 @@ fn retrieve_metric_name_from_promql(query: &str) -> Option { let query_metric_name = match plan { PromqlExpr::VectorSelector(vs) => vs .matchers - .find_matcher(promql_parser::label::METRIC_NAME) + .find_matchers(METRIC_NAME) + .into_iter() + .next() + .map(|m| m.value) .or_else(|| vs.name.clone()), PromqlExpr::MatrixSelector(ms) => ms .vs .matchers - .find_matcher(promql_parser::label::METRIC_NAME) + .find_matchers(METRIC_NAME) + .into_iter() + .next() + .map(|m| m.value) .or_else(|| ms.vs.name.clone()), _ => return Ok(true), }; diff --git a/src/servers/src/http/prometheus_resp.rs b/src/servers/src/http/prometheus_resp.rs index 0f9176cdf6ee..c4da273df5a3 100644 --- a/src/servers/src/http/prometheus_resp.rs +++ b/src/servers/src/http/prometheus_resp.rs @@ -26,7 +26,7 @@ use datatypes::prelude::ConcreteDataType; use datatypes::scalars::ScalarVector; use datatypes::vectors::{Float64Vector, StringVector, TimestampMillisecondVector}; use promql_parser::label::METRIC_NAME; -use promql_parser::parser::ValueType; +use promql_parser::parser::value::ValueType; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_json::Value; From 3f1bac252efd3996020be7c91eb77540c2999e29 Mon Sep 17 00:00:00 2001 From: tison Date: Mon, 27 May 2024 09:36:11 +0800 Subject: [PATCH 4/4] concise method Signed-off-by: tison --- src/promql/src/planner.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/promql/src/planner.rs b/src/promql/src/planner.rs index 7e47b8702157..79100187fe58 100644 --- a/src/promql/src/planner.rs +++ b/src/promql/src/planner.rs @@ -640,11 +640,7 @@ impl PromPlanner { let _ = matchers.insert(matcher.clone()); } } - let matchers = matchers.into_iter().collect(); - Ok(Matchers { - matchers, - or_matchers: vec![], - }) + Ok(Matchers::new(matchers.into_iter().collect())) } async fn selector_to_series_normalize_plan(