Skip to content

Commit

Permalink
fixup! feat(lapis2): allow filtering for null
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKellerer committed May 7, 2024
1 parent 3786063 commit 6f64c53
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ class SiloFilterExpressionMapper(
val (_, values, originalKey) = sequenceFilterValue ?: return null
val value = extractSingleFilterValue(values, originalKey)

if (value.isNullOrBlank()) {
return null
}

try {
return LocalDate.parse(value)
} catch (exception: DateTimeParseException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,24 @@ class SiloFilterExpressionMapperTest {
),
And(DateBetween("date", from = null, to = LocalDate.of(2021, 6, 3))),
),
Arguments.of(
mapOf(
"dateTo" to listOf(null),
),
And(DateBetween("date", from = null, to = null)),
),
Arguments.of(
mapOf(
"dateFrom" to listOf("2021-03-28"),
),
And(DateBetween("date", from = LocalDate.of(2021, 3, 28), to = null)),
),
Arguments.of(
mapOf(
"dateFrom" to listOf(null),
),
And(DateBetween("date", from = null, to = null)),
),
Arguments.of(
mapOf(
"dateFrom" to listOf("2021-03-28"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ class SiloQueryTest {
),
Arguments.of(
AminoAcidSymbolEquals("gene name", 1234, "A"),
"""
"""
{
"type": "AminoAcidEquals",
"sequenceName": "gene name",
Expand Down

0 comments on commit 6f64c53

Please sign in to comment.