Skip to content

Commit

Permalink
Merge branch 'filodb:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-shipit committed Aug 4, 2023
2 parents 033ff49 + dd59325 commit 297d1ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,10 @@ class PartKeyLuceneIndex(ref: DatasetRef,
filter match {
case EqualsRegex(value) =>
val regex = removeRegexAnchors(value.toString)
if (regex.replaceAll("\\.\\*", "").nonEmpty) new RegexpQuery(new Term(column, regex), RegExp.NONE)
if (regex.replaceAll("\\.\\*", "") == "")
new MatchAllDocsQuery
else if (regex.nonEmpty)
new RegexpQuery(new Term(column, regex), RegExp.NONE)
else leafFilter(column, NotEqualsRegex(".+")) // value="" means the label is absent or has an empty value.

case NotEqualsRegex(value) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1058,5 +1058,11 @@ class PartKeyLuceneIndexSpec extends AnyFunSpec with Matchers with BeforeAndAfte
val expected5 = Seq(pkrs(7), pkrs(8), pkrs(9))
result5.map(_.partKey.toSeq) shouldEqual expected5.map(_.partKey.toSeq)
result5.map(p => (p.startTime, p.endTime)) shouldEqual expected5.map(p => (p.startTime, p.endTime))


val filter10 = ColumnFilter("Actor2Code", EqualsRegex(".*".utf8))
val result10= keyIndex.partKeyRecordsFromFilters(Seq(filter10), 0, Long.MaxValue)
result10.map(_.partKey.toSeq) shouldEqual pkrs.map(_.partKey.toSeq)
result10.map(p => (p.startTime, p.endTime)) shouldEqual pkrs.map(p => (p.startTime, p.endTime))
}
}

0 comments on commit 297d1ea

Please sign in to comment.