fix: promql regex escape behavior (#6094)

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
Ruihang Xia
2025-05-14 02:19:17 +08:00
committed by GitHub
parent 30f1cbf0bf
commit 209f8371f2
4 changed files with 21 additions and 3 deletions

4
Cargo.lock generated
View File

@@ -8971,8 +8971,7 @@ dependencies = [
[[package]]
name = "promql-parser"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60d851f6523a8215e2fbf86b6cef4548433f8b76092e9ffb607105de52ae63fd"
source = "git+https://github.com/GreptimeTeam/promql-parser.git?rev=711d484d9e19b19e073f0cbfd2dd16ad031972b6#711d484d9e19b19e073f0cbfd2dd16ad031972b6"
dependencies = [
"cfgrammar",
"chrono",
@@ -8982,6 +8981,7 @@ dependencies = [
"regex",
"serde",
"serde_json",
"unescaper",
]
[[package]]

View File

@@ -163,7 +163,9 @@ parquet = { version = "54.2", default-features = false, features = ["arrow", "as
paste = "1.0"
pin-project = "1.0"
prometheus = { version = "0.13.3", features = ["process"] }
promql-parser = { version = "0.5.1", features = ["ser"] }
promql-parser = { git = "https://github.com/GreptimeTeam/promql-parser.git", rev = "711d484d9e19b19e073f0cbfd2dd16ad031972b6", features = [
"ser",
] }
prost = { version = "0.13", features = ["no-recursion-limit"] }
raft-engine = { version = "0.4.1", default-features = false }
rand = "0.9"

View File

@@ -36,6 +36,20 @@ TQL EVAL (0, 100, '15s') test{host=~"(10.0.160.237:8080|10.0.160.237:9090)"};
| 1970-01-01T00:01:30 | 10.0.160.237:8080 | 1 |
+---------------------+-------------------+-----+
TQL EVAL (0, 100, '15s') test{host=~"(10\\.0\\.160\\.237:8080|10\\.0\\.160\\.237:9090)"};
+---------------------+-------------------+-----+
| ts | host | val |
+---------------------+-------------------+-----+
| 1970-01-01T00:00:00 | 10.0.160.237:8080 | 1 |
| 1970-01-01T00:00:15 | 10.0.160.237:8080 | 1 |
| 1970-01-01T00:00:30 | 10.0.160.237:8080 | 1 |
| 1970-01-01T00:00:45 | 10.0.160.237:8080 | 1 |
| 1970-01-01T00:01:00 | 10.0.160.237:8080 | 1 |
| 1970-01-01T00:01:15 | 10.0.160.237:8080 | 1 |
| 1970-01-01T00:01:30 | 10.0.160.237:8080 | 1 |
+---------------------+-------------------+-----+
DROP TABLE test;
Affected Rows: 0

View File

@@ -13,4 +13,6 @@ SELECT * FROM test;
TQL EVAL (0, 100, '15s') test{host=~"(10.0.160.237:8080|10.0.160.237:9090)"};
TQL EVAL (0, 100, '15s') test{host=~"(10\\.0\\.160\\.237:8080|10\\.0\\.160\\.237:9090)"};
DROP TABLE test;