You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ro...@apache.org on 2023/12/20 17:06:38 UTC
(pinot) branch master updated: fix regex gen with escape issue on single quote (#12181)
This is an automated email from the ASF dual-hosted git repository.
rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 85d3850227 fix regex gen with escape issue on single quote (#12181)
85d3850227 is described below
commit 85d3850227cb648cac30e5b3d12f1e09c3920551
Author: Rong Rong <ro...@apache.org>
AuthorDate: Wed Dec 20 09:06:31 2023 -0800
fix regex gen with escape issue on single quote (#12181)
Co-authored-by: Rong Rong <ro...@startree.ai>
---
.../test/java/org/apache/pinot/integration/tests/QueryGenerator.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pinot-integration-test-base/src/test/java/org/apache/pinot/integration/tests/QueryGenerator.java b/pinot-integration-test-base/src/test/java/org/apache/pinot/integration/tests/QueryGenerator.java
index be13943d59..8e3d3a84d9 100644
--- a/pinot-integration-test-base/src/test/java/org/apache/pinot/integration/tests/QueryGenerator.java
+++ b/pinot-integration-test-base/src/test/java/org/apache/pinot/integration/tests/QueryGenerator.java
@@ -1019,7 +1019,8 @@ public class QueryGenerator {
List<String> columnValues = _columnToValueList.get(columnName);
String value = pickRandom(columnValues);
// do regex only for string type
- if (value.startsWith("'") && value.endsWith("'")) {
+ // do not replace when there's single quote in between b/c it will cause escape issues.
+ if (value.startsWith("'") && value.endsWith("'") && !value.substring(1, value.length() - 1).contains("'")) {
// replace only one character for now with .* ignore the first and last character
int indexToReplaceWithRegex = 1 + _random.nextInt(value.length() - 2);
String regex = value.substring(1, indexToReplaceWithRegex) + ".*" + value.substring(indexToReplaceWithRegex + 1,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org