From 1946313cfa193b3567a87d076c308516883fbc44 Mon Sep 17 00:00:00 2001 From: Ronak Date: Tue, 17 Oct 2023 16:36:38 +0530 Subject: [PATCH] chore: adding dummy test case for testing --- .../documentstore/DocStoreQueryV1Test.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/document-store/src/integrationTest/java/org/hypertrace/core/documentstore/DocStoreQueryV1Test.java b/document-store/src/integrationTest/java/org/hypertrace/core/documentstore/DocStoreQueryV1Test.java index ea6ef66c..d6686b42 100644 --- a/document-store/src/integrationTest/java/org/hypertrace/core/documentstore/DocStoreQueryV1Test.java +++ b/document-store/src/integrationTest/java/org/hypertrace/core/documentstore/DocStoreQueryV1Test.java @@ -81,6 +81,8 @@ import org.hypertrace.core.documentstore.expression.impl.LogicalExpression; import org.hypertrace.core.documentstore.expression.impl.RelationalExpression; import org.hypertrace.core.documentstore.expression.impl.UnnestExpression; +import org.hypertrace.core.documentstore.expression.operators.SortOrder; +import org.hypertrace.core.documentstore.expression.type.SortTypeExpression; import org.hypertrace.core.documentstore.model.options.UpdateOptions; import org.hypertrace.core.documentstore.model.subdoc.SubDocumentUpdate; import org.hypertrace.core.documentstore.model.subdoc.SubDocumentValue; @@ -1004,6 +1006,32 @@ void testQueryQ1DistinctCountAggregationWithMatchingSelectionAndGroupBy(String d } } + @ParameterizedTest + @ArgumentsSource(PostgresProvider.class) + void testQueryQ1CountAggregationWithMultipleSelectionAndGroupBy(String dataStoreName) + throws IOException { + Datastore datastore = datastoreMap.get(dataStoreName); + Collection collection = datastore.getCollection(COLLECTION_NAME); + org.hypertrace.core.documentstore.query.Query query = + org.hypertrace.core.documentstore.query.Query.builder() + .addSelection( + AggregateExpression.of(COUNT, IdentifierExpression.of("quantity")), + "qty_count") + .addSelection(IdentifierExpression.of("item"), "ITEM") + .addSelection(IdentifierExpression.of("props.size"), "PROP_SIZE") + .setFilter( + RelationalExpression.of( + IdentifierExpression.of("price"), LTE, ConstantExpression.of(10))) + .addAggregation(IdentifierExpression.of("item")) + .addAggregation(IdentifierExpression.of("props.size")) + .addSort(IdentifierExpression.of("PROP_SIZE"), ASC) + .build(); + try (CloseableIterator resultDocs = collection.aggregate(query)) { + assertDocsAndSizeEqualWithoutOrder( + dataStoreName, resultDocs, "query/test_aggr_with_match_selection_and_groupby.json", 3); + } + } + @ParameterizedTest @ArgumentsSource(AllProvider.class) public void testQueryV1ForSimpleWhereClause(String dataStoreName) throws IOException {