Skip to content

Commit

Permalink
isPipeOnlyRegex -> containsPipeOnlyRegex
Browse files Browse the repository at this point in the history
  • Loading branch information
alextheimer committed Oct 20, 2023
1 parent 6f85103 commit 6ee1b83
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ class PartKeyLuceneIndex(ref: DatasetRef,
} else if (!QueryUtils.containsRegexChars(regex)) {
// if all regex special chars absent, then treat like Equals
equalsQuery(regex)
} else if (QueryUtils.isPipeOnlyRegex(regex)) {
} else if (QueryUtils.containsPipeOnlyRegex(regex)) {
// if pipe is only regex special char present, then convert to IN query
new TermInSetQuery(column, regex.split('|').map(t => new BytesRef(t)): _*)
} else if (regex.endsWith(".*") && regex.length > 2 &&
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/filodb.core/query/QueryUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object QueryUtils {
* characters except the pipe character ('|').
* True is also returned when the string contains no pipes.
*/
def isPipeOnlyRegex(str: String): Boolean = {
def containsPipeOnlyRegex(str: String): Boolean = {
str.forall(!regexCharsMinusPipe.contains(_))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ sealed trait Vector extends Expression {
case RegexMatch =>
// Relax the length limit only for matchers that contain at most the "|" special character.
val shouldRelax = queryConfig.hasPath("relaxed-pipe-only-equals-regex-limit") &&
QueryUtils.isPipeOnlyRegex(labelValue)
QueryUtils.containsPipeOnlyRegex(labelValue)
if (shouldRelax) {
val limit = queryConfig.getInt("relaxed-pipe-only-equals-regex-limit");
require(labelValue.length <= limit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ object Parser extends StrictLogging {
case RegexMatch =>
// Relax the length limit only for matchers that contain at most the "|" special character.
val shouldRelax = queryConf.hasPath("relaxed-pipe-only-equals-regex-limit") &&
QueryUtils.isPipeOnlyRegex(l.value)
QueryUtils.containsPipeOnlyRegex(l.value)
if (shouldRelax) {
val limit = queryConf.getInt("relaxed-pipe-only-equals-regex-limit");
require(l.value.length <= limit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object PrometheusModel {
case MatchType.REGEX_MATCH =>
// Relax the length limit only for matchers that contain at most the "|" special character.
val shouldRelax = queryConfig.getBoolean("relaxed-pipe-only-equals-regex-limit") &&
QueryUtils.isPipeOnlyRegex(m.getValue)
QueryUtils.containsPipeOnlyRegex(m.getValue)
if (shouldRelax) {
val limit = queryConfig.getInt("relaxed-pipe-only-equals-regex-limit");
require(m.getValue.length <= limit,
Expand Down

0 comments on commit 6ee1b83

Please sign in to comment.