Timothy Potter created SOLR-9372: ------------------------------------ Summary: Different data types returned depending on the aggregation mode used to execute a SQL statement Key: SOLR-9372 URL: https://issues.apache.org/jira/browse/SOLR-9372 Project: Solr Issue Type: Bug Security Level: Public (Default Security Level. Issues are Public) Affects Versions: 6.1 Reporter: Timothy Potter
The type of aggregation fields returned differs based on the aggregation mode. Here's an example: {code} curl --data-urlencode 'stmt=SELECT movie_id, COUNT(*) as agg_count, avg(rating) as avg_rating, sum(rating) as sum_rating, min(rating) as min_rating, max(rating) as max_rating FROM movielens_ratings GROUP BY movie_id ORDER BY movie_id asc' "http://localhost:8984/solr/movielens_ratings/sql?aggregationMode=facet" {"result-set":{"docs":[ {"min_rating":1.0,"avg_rating":3.8783185840707963,"sum_rating":1753.0,"movie_id":"1","agg_count":452,"max_rating":5.0}, {"min_rating":1.0,"avg_rating":3.831460674157303,"sum_rating":341.0,"movie_id":"10","agg_count":89,"max_rating":5.0}, {"min_rating":1.0,"avg_rating":4.155511811023622,"sum_rating":2111.0,"movie_id":"100","agg_count":508,"max_rating":5.0}, {"min_rating":2.0,"avg_rating":3.0,"sum_rating":30.0,"movie_id":"1000","agg_count":10,"max_rating":4.0}, {"min_rating":1.0,"avg_rating":2.0,"sum_rating":34.0,"movie_id":"1001","agg_count":17,"max_rating":5.0}, {"min_rating":1.0,"avg_rating":1.875,"sum_rating":15.0,"movie_id":"1002","agg_count":8,"max_rating":4.0}, {"min_rating":1.0,"avg_rating":2.25,"sum_rating":18.0,"movie_id":"1003","agg_count":8,"max_rating":4.0}, ... {code} {code} curl --data-urlencode 'stmt=SELECT movie_id, COUNT(*) as agg_count, avg(rating) as avg_rating, sum(rating) as sum_rating, min(rating) as min_rating, max(rating) as max_rating FROM movielens_ratings GROUP BY movie_id ORDER BY movie_id asc' "http://localhost:8984/solr/movielens_ratings/sql?aggregationMode=map_reduce" {"result-set":{"docs":[ {"min_rating":1,"avg_rating":3.8783185840707963,"sum_rating":1753,"movie_id":"1","agg_count":452,"max_rating":5}, {"min_rating":1,"avg_rating":3.831460674157303,"sum_rating":341,"movie_id":"10","agg_count":89,"max_rating":5}, {"min_rating":1,"avg_rating":4.155511811023622,"sum_rating":2111,"movie_id":"100","agg_count":508,"max_rating":5}, {"min_rating":2,"avg_rating":3.0,"sum_rating":30,"movie_id":"1000","agg_count":10,"max_rating":4}, {"min_rating":1,"avg_rating":2.0,"sum_rating":34,"movie_id":"1001","agg_count":17,"max_rating":5}, {"min_rating":1,"avg_rating":1.875,"sum_rating":15,"movie_id":"1002","agg_count":8,"max_rating":4}, {"min_rating":1,"avg_rating":2.25,"sum_rating":18,"movie_id":"1003","agg_count":8,"max_rating":4}, {"min_rating":1,"avg_rating":3.111111111111111,"sum_rating":28,"movie_id":"1004","agg_count":9,"max_rating":4}, {"min_rating":1,"avg_rating":3.6818181818181817,"sum_rating":81,"movie_id":"1005","agg_count":22,"max_rating":5}, {code} The rating field is an integer in Solr (TrieIntField) so one would expect the sum, min, max functions to return Long type but when using aggregationMode=facet, we get back doubles. Data types should be consistent so client applications don't have to account for this weirdness. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org