-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Prometheus]Bug fix for less than and greater than operators on @time…
…stamp Signed-off-by: vamsi-amazon <[email protected]>
- Loading branch information
Showing
6 changed files
with
182 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../org/opensearch/sql/prometheus/storage/querybuilders/TimeRangeParametersResolverTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* | ||
* * Copyright OpenSearch Contributors | ||
* * SPDX-License-Identifier: Apache-2.0 | ||
* | ||
*/ | ||
|
||
package org.opensearch.sql.prometheus.storage.querybuilders; | ||
|
||
import static org.opensearch.sql.data.model.ExprValueUtils.stringValue; | ||
import static org.opensearch.sql.data.type.ExprCoreType.STRING; | ||
|
||
import org.apache.commons.math3.util.Pair; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.opensearch.sql.expression.DSL; | ||
import org.opensearch.sql.prometheus.storage.querybuilder.TimeRangeParametersResolver; | ||
|
||
public class TimeRangeParametersResolverTest { | ||
|
||
@Test | ||
void testTimeRangeParametersWithoutTimestampFilter() { | ||
TimeRangeParametersResolver timeRangeParametersResolver = new TimeRangeParametersResolver(); | ||
Pair<Long, Long> result = timeRangeParametersResolver.resolve( | ||
DSL.and(DSL.less(DSL.ref("code", STRING), DSL.literal(stringValue("200"))), | ||
DSL.equal(DSL.ref("handler", STRING), DSL.literal(stringValue("/ready/"))))); | ||
Assertions.assertNotNull(result); | ||
Assertions.assertEquals(3600, result.getSecond() - result.getFirst()); | ||
} | ||
} |