vespa icon indicating copy to clipboard operation
vespa copied to clipboard

Vespa grouping language requires grouping to take place

Open lukasmoellerch opened this issue 1 year ago • 4 comments

Describe the bug Certain vespa grouping language snippets don't work like I'd expect them to work, I was instructed to open a GH issue as per recommendation of @bratseth. Specifically I'd assume that the grouping command all(output(min(price))) is equivalent to all(group(1) each(output(min(price)))). Instead the following error is returned when the first query is executed:

Failed: Cannot invoke "com.yahoo.searchlib.expression.SingleResultNode.min(com.yahoo.searchlib.expression.ResultNode)" because "this.min" is null", "stackTrace":"java.lang.NullPointerException: Cannot invoke "com.yahoo.searchlib.expression.SingleResultNode.min(com.yahoo.searchlib.expression.ResultNode)" because "this.min" is null at com.yahoo.searchlib.aggregation.MinAggregationResult.onMerge(MinAggregationResult.java:81) at com.yahoo.searchlib.aggregation.AggregationResult.merge(AggregationResult.java:49) at com.yahoo.searchlib.aggregation.Group.merge(Group.java:82) at com.yahoo.searchlib.aggregation.Grouping.merge(Grouping.java:70) at com.yahoo.search.grouping.vespa.GroupingExecutor.mergeGroupingMaps(GroupingExecutor.java:280) at com.yahoo.search.grouping.vespa.GroupingExecutor.performSearch(GroupingExecutor.java:254) at com.yahoo.search.grouping.vespa.GroupingExecutor.search(GroupingExecutor.java:91) at com.yahoo.search.Searcher.process(Searcher.java:134) at com.yahoo.processing.execution.Execution.process(Execution.java:112) at com.yahoo.search.searchchain.Execution.search(Execution.java:499) at com.yahoo.search.searchers.ValidateFuzzySearcher.search(ValidateFuzzySearcher.java:42) at com.yahoo.search.Searcher.process(Searcher.java:134) at com.yahoo.processing.execution.Execution.process(Execution.java:112) at com.yahoo.search.searchchain.Execution.search(Execution.java:499) at com.yahoo.search.searchers.ValidateMatchPhaseSearcher.search(ValidateMatchPhaseSearcher.java:55) at com.yahoo.search.Searcher.process(Searcher.java:134) at com.yahoo.processing.execution.Execution.process(Execution.java:112) at com.yahoo.search.searchchain.Execution.search(Execution.java:499) at com.yahoo.search.searchers.ValidateNearestNeighborSearcher.search(ValidateNearestNeighborSearcher.java:51) at com.yahoo.search.Searcher.process(Searcher.java:134) at com.yahoo.processing.execution.Execution.process(Execution.java:112) at com.yahoo.search.searchchain.Execution.search(Execution.java:499) at

To Reproduce Steps to reproduce the behavior:

  1. Go to https://docs.vespa.ai/en/grouping.html2.
  2. Enter "all(group(1) each(output(min(price))))"
  3. Execute the query

Expected behavior I would expect the query to return the minimum price over all results.

Screenshots Screenshot 2022-09-07 at 16 50 44

Environment (please complete the following information):

  • OS: macOS
  • Infrastructure: self-hosted arm docker image
  • Versions 12.4

Vespa version 8.37.26

Additional context Add any other context about the problem here.

lukasmoellerch avatar Sep 07 '22 14:09 lukasmoellerch

Hi @lukasmoellerch. The query all(output(min(price))) is invalid - a group clause is required. Using a fixed value as the expression for group produces the expected result: https://doc-search.vespa.oath.cloud/search/?yql=select%20*%20from%20purchase%20where%20true%20%7C%20all(group(1)each(output(min(price)))).

The lack of group should produce a proper error response and not cause the searcher to crash. I'll create a new issue to track that.

bjorncs avatar Sep 15 '22 10:09 bjorncs

A better error message is good, but I think aggregation without grouping is a valid use case and this should be a feature request.

bratseth avatar Sep 15 '22 10:09 bratseth