Skip to content
Permalink
Browse files

fixed #558; implicit group by at main select list of FACET query; add…

…ed regression to test 226
  • Loading branch information
tomatolog committed Nov 9, 2018
1 parent eb3c768 commit d915cf6696514f4be365ffb5981bccaa15983e65
Showing with 17 additions and 2 deletions.
  1. +12 −0 src/sphinxsort.cpp
  2. +2 −2 test/test_226/model.bin
  3. +3 −0 test/test_226/test.xml
@@ -5430,6 +5430,18 @@ ISphMatchSorter * sphCreateQueue ( SphQueueSettings_t & tQueue )
bImplicit = ( t.m_eAggrFunc!=SPH_AGGR_NONE ) || t.m_sExpr=="count(*)" || t.m_sExpr=="@distinct";
}

// count(*) and distinct wo group by at main query should keep implicit flag
if ( bImplicit && bHeadWOGroup )
{
bool bRefImplicit= false;
ARRAY_FOREACH_COND ( i, pQuery->m_dRefItems, !bRefImplicit )
{
const CSphQueryItem & t = pQuery->m_dItems[i];
bRefImplicit = ( t.m_eAggrFunc!=SPH_AGGR_NONE ) || t.m_sExpr=="count(*)" || t.m_sExpr=="@distinct";
}
bHeadWOGroup = !bRefImplicit;
}

if ( !SetupGroupbySettings ( pQuery, tSorterSchema, tSettings, dGroupColumns, sError, bImplicit ) )
return nullptr;

Large diffs are not rendered by default.

@@ -217,6 +217,9 @@ insert into facetdemo (id,price,brand_id,title,brand_name,property,categories,j)
<!-- regression crash on FACET\group by with different attribute sizes -->
<sphinxql>select * from facet_gr1 order by id asc facet price_i order by id asc facet price_b order by id asc; show meta</sphinxql>

<!-- regression need to keeo implicit group by for main query -->
<sphinxql>select id, price_b, count(*) from facet_gr1 order by id asc facet price_b order by id asc; show meta</sphinxql>

</sphqueries>

</test>

0 comments on commit d915cf6

Please sign in to comment.
You can’t perform that action at this time.