Skip to content

Commit

Permalink
added integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
singh-viikram committed Oct 17, 2024
1 parent 50162fa commit 54983c2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import static org.hypertrace.core.documentstore.expression.operators.AggregationOperator.COUNT;
import static org.hypertrace.core.documentstore.expression.operators.AggregationOperator.DISTINCT_ARRAY;
import static org.hypertrace.core.documentstore.expression.operators.AggregationOperator.DISTINCT_COUNT;
import static org.hypertrace.core.documentstore.expression.operators.AggregationOperator.LAST;
import static org.hypertrace.core.documentstore.expression.operators.AggregationOperator.MAX;
import static org.hypertrace.core.documentstore.expression.operators.AggregationOperator.MIN;
import static org.hypertrace.core.documentstore.expression.operators.AggregationOperator.SUM;
Expand Down Expand Up @@ -1334,6 +1335,24 @@ public void testQueryV1AggregationFilterWithWhereClause(String dataStoreName) th
dataStoreName, resultDocs, "query/test_aggr_filter_and_where_filter_result.json", 2);
}

@ParameterizedTest
@ArgumentsSource(AllProvider.class)
public void testQueryV1LastAggregationOperator(String dataStoreName) throws IOException {
Collection collection = getCollection(dataStoreName);

org.hypertrace.core.documentstore.query.Query query =
org.hypertrace.core.documentstore.query.Query.builder()
.addSelection(IdentifierExpression.of("item"))
.addAggregation(IdentifierExpression.of("item"))
.addSelection(
AggregateExpression.of(LAST, IdentifierExpression.of("price")), "last_price")
.build();

Iterator<Document> resultDocs = collection.aggregate(query);
assertDocsAndSizeEqualWithoutOrder(
dataStoreName, resultDocs, "query/test_last_aggregation_operator.json", 4);
}

@Nested
class StartsWithOperatorTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"item":"Shampoo",
"last_price":5
},
{
"item":"Comb",
"last_price":7.5
},
{
"item":"Mirror",
"last_price":20
},
{
"item":"Soap",
"last_price":20
}
]

0 comments on commit 54983c2

Please sign in to comment.