Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
93ac200
feat: enhance TDigest with additional percentile, quantile, and CDF m…
Nick-S-2018 Jan 7, 2026
7043203
feat: add new aggregation functions for percentiles and MAD
Nick-S-2018 Jan 8, 2026
01ebbb2
feat: implement new aggregation functions for percentiles and MAD
Nick-S-2018 Jan 8, 2026
d845747
feat: extend aggregation functionality to include PERCENTILES and MAD…
Nick-S-2018 Jan 8, 2026
ae1ac83
feat: implement TDigest handling for percentiles and percentile ranks…
Nick-S-2018 Jan 8, 2026
ac3b39d
fix: correct TDigest data loading and improve code readability
Nick-S-2018 Jan 12, 2026
d977e60
refactor: update file permissions and include necessary headers in sp…
Nick-S-2018 Jan 12, 2026
7591654
feat: add default percentile handling in JSON aggregation parsing
Nick-S-2018 Jan 12, 2026
1f6101b
feat: add support for PERCENTILES and PERCENTILE_RANKS in aggregate e…
Nick-S-2018 Jan 13, 2026
31f9eda
feat: enhance aggregation logging for PERCENTILES, PERCENTILE_RANKS, …
Nick-S-2018 Jan 13, 2026
ca72b93
refactor: improve aggregation logging by simplifying string concatena…
Nick-S-2018 Jan 13, 2026
2646ce0
refactor: improve aggregation handling by using aliases for attributes
Nick-S-2018 Jan 13, 2026
9f4b49d
feat: add support for MAD and extend aggregation handling in CreateMs…
Nick-S-2018 Jan 13, 2026
f730b49
feat: enhance CreateMsearchHandler with improved aggregation type han…
Nick-S-2018 Jan 13, 2026
9f6d114
feat: update aggregation handling in CSphColumnInfo and QueueCreator
Nick-S-2018 Jan 13, 2026
785721b
feat: enhance aggregation handling in QueueCreator for new input types
Nick-S-2018 Jan 13, 2026
687903d
feat: refine aggregation handling in CreateMsearchHandler for specifi…
Nick-S-2018 Jan 13, 2026
7ba7c7f
feat: enhance TDigest value logging in aggregation processing
Nick-S-2018 Jan 14, 2026
4ab641d
feat: add input expression evaluation to TDigest aggregation
Nick-S-2018 Jan 14, 2026
3a192e5
feat: add support for additional aggregation types in CreateMsearchHa…
Nick-S-2018 Jan 14, 2026
d277917
feat: implement MAD calculation in aggregation processing
Nick-S-2018 Jan 14, 2026
70a2844
feat: optimize MAD calculation integration in aggregation processing
Nick-S-2018 Jan 14, 2026
5634c97
refactor: simplify FreeTDigestBlob function signature
Nick-S-2018 Jan 14, 2026
728a07b
refactor: remove unused FreeTDigestBlob function
Nick-S-2018 Jan 14, 2026
0a687bc
feat: enhance TDigest with min/max tracking and serialization
Nick-S-2018 Jan 15, 2026
1ece291
fix: update default compression value in AggrMadSetting_t structure
Nick-S-2018 Jan 16, 2026
cb433c8
feat: add logging for TDIGEST setup attributes
Nick-S-2018 Jan 16, 2026
977d3f9
feat: add debug logging for MAD calculation process
Nick-S-2018 Jan 16, 2026
37a80f9
fix: refine TDigest interpolation logic for improved accuracy
Nick-S-2018 Jan 16, 2026
22bbdc8
refactor: rename interpolation function for clarity and add new imple…
Nick-S-2018 Jan 16, 2026
9ea22aa
fix: enhance TDigest interpolation logic for tail values
Nick-S-2018 Jan 16, 2026
619208e
fix: adjust TDigest interpolation logic for maximum value handling
Nick-S-2018 Jan 16, 2026
39be5c0
refactor: remove atomic debug logging from TDigest and MAD calculations
Nick-S-2018 Jan 16, 2026
53a1820
refactor: remove unused debug logging for schema in aggregation funct…
Nick-S-2018 Jan 16, 2026
edcb05a
refactor: optimize TDigest centroid import process
Nick-S-2018 Jan 20, 2026
dc48e59
refactor: streamline TDigest implementation by removing internal map …
Nick-S-2018 Jan 20, 2026
1546f7e
refactor: enhance TDigest runtime state management and blob handling
Nick-S-2018 Jan 20, 2026
72c8b49
refactor: implement move semantics and delete copy operations in TDig…
Nick-S-2018 Jan 20, 2026
dc9ac32
chore: update file permissions for aggregate.h
Nick-S-2018 Jan 20, 2026
2cc506a
refactor: add move constructor and move assignment operator to TDiges…
Nick-S-2018 Jan 20, 2026
5896929
refactor: remove move constructor and move assignment operator from T…
Nick-S-2018 Jan 20, 2026
eae7318
refactor: add Discard method to aggregate interface
Nick-S-2018 Jan 20, 2026
c5112d0
refactor: implement OnMatchFree method in CSphMatchQueueTraits
Nick-S-2018 Jan 20, 2026
18a5ea9
Updated aggregate header
Nick-S-2018 Jan 20, 2026
4c42268
refactor: make OnMatchFree method virtual in CSphMatchQueueTraits
Nick-S-2018 Jan 20, 2026
7ba88d5
refactor: add OnMatchFree usage in SorterGroup
Nick-S-2018 Jan 20, 2026
c15e398
refactor: update OnMatchFree usage in SorterGroup
Nick-S-2018 Jan 20, 2026
7d296f6
refactor: replace OnMatchFree call with AggrDiscard in CSphImplicitGr…
Nick-S-2018 Jan 20, 2026
b5169cc
refactor: update attribute management with new TDigest runtime functions
Nick-S-2018 Jan 20, 2026
db7576b
refactor: streamline TDigest runtime management by utilizing new help…
Nick-S-2018 Jan 20, 2026
23872c3
Updated aggregate.cpp
Nick-S-2018 Jan 20, 2026
27cb0b6
feat: introduce AggrDiagnostics structure and accumulate counters for…
Nick-S-2018 Jan 21, 2026
74da24a
refactor: remove AccumulateCounters method and restructure Stats_t in…
Nick-S-2018 Jan 21, 2026
fa72b2f
fix: set attribute in SerializeRuntime method of AggrTDigestBase_c
Nick-S-2018 Jan 21, 2026
2cd7504
refactor: remove AggrDiagnostics_t structure and related methods from…
Nick-S-2018 Jan 21, 2026
976f475
feat: add DumpDiagnostics method to aggregate classes for enhanced lo…
Nick-S-2018 Jan 21, 2026
c8b2d69
Updated sortertraits.cpp
Nick-S-2018 Jan 21, 2026
1c2b6a7
feat: enhance aggregate diagnostics logging in SorterGroup
Nick-S-2018 Jan 21, 2026
8e42955
Updated sortergroup.cpp
Nick-S-2018 Jan 21, 2026
e73b552
refactor: optimize TDigest implementation with buffer management and …
Nick-S-2018 Jan 21, 2026
03209c0
refactor: streamline TDigest class by removing unnecessary methods an…
Nick-S-2018 Jan 22, 2026
4220226
feat: implement pending value management in TDigest runtime for impro…
Nick-S-2018 Jan 22, 2026
9672cf0
Updated tdigest_runtime.cpp
Nick-S-2018 Jan 22, 2026
7d68e83
feat: introduce slim TDigest support in QueueCreator
Nick-S-2018 Jan 22, 2026
0a922df
refactor: remove group emulation check from slim TDigest enabling logic
Nick-S-2018 Jan 22, 2026
c246fc0
feat: enhance MAD calculation in TDigest by introducing deviation tra…
Nick-S-2018 Jan 22, 2026
d56f6d1
refactor: remove unused variable in MAD calculation for TDigest
Nick-S-2018 Jan 22, 2026
98fcb19
refactor: simplify MAD calculation in TDigest by leveraging TDigest f…
Nick-S-2018 Jan 22, 2026
faf25cd
refactor: enhance MAD calculation logic in TDigest by handling empty …
Nick-S-2018 Jan 22, 2026
3cb4b1d
refactor: optimize MAD calculation in TDigest by directly utilizing d…
Nick-S-2018 Jan 22, 2026
a5d2f57
refactor: enhance MAD calculation in TDigest by implementing deviatio…
Nick-S-2018 Jan 22, 2026
cf869d7
refactor: optimize MAD calculation in TDigest by streamlining deviati…
Nick-S-2018 Jan 22, 2026
4ed13b4
Reverted last commit
Nick-S-2018 Jan 22, 2026
b9f8089
refactor: streamline MAD calculation in TDigest by optimizing deviati…
Nick-S-2018 Jan 22, 2026
67e6d10
Removed diagnostic parts
Nick-S-2018 Jan 23, 2026
7027183
Added test and clt-test for elastic-like percentile and MAD aggregations
Nick-S-2018 Jan 27, 2026
0fe4124
Removed redundant headers
Nick-S-2018 Jan 27, 2026
3b2a93b
Updated test_479 with a distributed tables case
Nick-S-2018 Jan 27, 2026
c976af5
Updated test_479 model and confirmed changes in queuecreator.cpp
Nick-S-2018 Jan 28, 2026
b88abfe
Confirmed updates
Nick-S-2018 Jan 28, 2026
da46e40
Renamed test_479 to test_481
Nick-S-2018 Jan 28, 2026
af275a7
Revert "Confirmed updates"
Nick-S-2018 Jan 28, 2026
5a1444c
Revert "Updated test_479 model and confirmed changes in queuecreator.…
Nick-S-2018 Jan 28, 2026
6d3d0da
Revert "Updated test_479 with a distributed tables case"
Nick-S-2018 Jan 28, 2026
89ca488
Added new real-time index 'agg_td2' and updated distributed index 'di…
Nick-S-2018 Jan 28, 2026
f28c922
Updated model for test_481
Nick-S-2018 Jan 28, 2026
207774d
Updated test.xml for test_481 to modify the insert values for 'agg_td…
Nick-S-2018 Jan 28, 2026
b95e7ba
Renamed test_481 to test_482
Nick-S-2018 Jan 28, 2026
42a8c7a
added cases for the MAD skewed distributions
tomatolog Feb 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
386 changes: 383 additions & 3 deletions src/aggregate.cpp
100644 → 100755

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/aggregate.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AggrFunc_i
virtual void Update ( CSphMatch & tDst, const CSphMatch & tSrc, bool bGrouped, bool bMerge ) = 0;
virtual void Setup ( CSphMatch & tDst, const CSphMatch & tSrc, bool bMerge ) {}
virtual void Finalize ( CSphMatch & tDst ) {}
virtual void Discard ( CSphMatch & tDst ) {}
virtual void SetColumnar ( columnar::Columnar_i * pColumnar ) {}
};

Expand All @@ -34,6 +35,10 @@ AggrFunc_i * CreateAggrAvg ( const CSphColumnInfo & tAttr, const CSphAttrLocator
AggrFunc_i * CreateAggrMin ( const CSphColumnInfo & tAttr );
AggrFunc_i * CreateAggrMax ( const CSphColumnInfo & tAttr );

AggrFunc_i * CreateAggrPercentiles ( const CSphColumnInfo & tAttr );
AggrFunc_i * CreateAggrPercentileRanks ( const CSphColumnInfo & tAttr );
AggrFunc_i * CreateAggrMad ( const CSphColumnInfo & tAttr );

AggrFunc_i * CreateAggrConcat ( const CSphColumnInfo & tAttr );

#endif // _aggregate_
27 changes: 26 additions & 1 deletion src/aggrexpr.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ enum class Aggr_e
MIN,
MAX,
SUM,
AVG
AVG,
PERCENTILES,
PERCENTILE_RANKS,
MAD
};

struct DateRangeSetting_t
Expand All @@ -85,13 +88,35 @@ struct AggrDateHistSetting_t
bool m_bFixed = false;
};

struct AggrPercentilesSetting_t
{
CSphVector<float> m_dPercents;
bool m_bKeyed = false;
double m_fCompression = 200.0;
};

struct AggrPercentileRanksSetting_t
{
CSphVector<double> m_dValues;
bool m_bKeyed = false;
double m_fCompression = 200.0;
};

struct AggrMadSetting_t
{
double m_fCompression = 1000.0;
};

struct AggrSettings_t
{
Aggr_e m_eAggrFunc { Aggr_e::NONE };
AggrRangeSetting_t m_tRange;
AggrHistSetting_t m_tHist;
AggrDateRangeSetting_t m_tDateRange;
AggrDateHistSetting_t m_tDateHist;
AggrPercentilesSetting_t m_tPercentiles;
AggrPercentileRanksSetting_t m_tPercentileRanks;
AggrMadSetting_t m_tMad;
};

ISphExpr * CreateExprRange ( ISphExpr * pAttr, const AggrRangeSetting_t & tRanges );
Expand Down
29 changes: 29 additions & 0 deletions src/attribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//

#include "attribute.h"
#include "std/tdigest_runtime.h"

#include "sphinxint.h"
#include "sphinxjson.h"
Expand Down Expand Up @@ -1139,6 +1140,34 @@ ByteBlob_t sphUnpackPtrAttr ( const BYTE * pData )
return { pData, iLen };
}

BYTE * sphCopyPackedAttr ( const BYTE * pData )
{
ByteBlob_t dBlob = sphUnpackPtrAttr ( pData );
if ( sphIsTDigestRuntimeBlob ( dBlob ) )
return sphCloneTDigestRuntimeBlob ( dBlob );
return sphPackPtrAttr ( dBlob );
}


void sphDeallocatePacked ( const BYTE* pBlob )
{
if ( !pBlob )
return;

const BYTE * pPayload = pBlob;
int iLen = (int)UnzipIntBE ( pPayload );
ByteBlob_t dBlob { pPayload, iLen };

if ( sphIsTDigestRuntimeBlob ( dBlob ) )
sphDestroyTDigestRuntimeBlob ( dBlob );

#if WITH_SMALLALLOC
sphDeallocateSmall ( pBlob, sphCalcPackedLength ( iLen ) );
#else
sphDeallocateSmall ( pBlob );
#endif
}


ESphAttr sphPlainAttrToPtrAttr ( ESphAttr eAttrType )
{
Expand Down
14 changes: 2 additions & 12 deletions src/attribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ ESphAttr sphPlainAttrToPtrAttr ( ESphAttr eAttrType );
bool sphIsDataPtrAttr ( ESphAttr eAttrType );

// just repack (matter of optimizing)
FORCE_INLINE BYTE * sphCopyPackedAttr ( const BYTE * pData ) { return sphPackPtrAttr ( sphUnpackPtrAttr ( pData ) ); }
BYTE * sphCopyPackedAttr ( const BYTE * pData );

//////////////////////////////////////////////////////////////////////////
// misc attribute-related
Expand All @@ -159,17 +159,7 @@ FORCE_INLINE DocID_t sphGetDocID ( const CSphRowitem * pData )
#endif
}

FORCE_INLINE void sphDeallocatePacked ( const BYTE* pBlob )
{
if ( !pBlob )
return;
#if WITH_SMALLALLOC
const BYTE * pFoo = pBlob;
sphDeallocateSmall ( pBlob, sphCalcPackedLength ( UnzipIntBE ( pFoo ) ) );
#else
sphDeallocateSmall ( pBlob );
#endif
}
void sphDeallocatePacked ( const BYTE* pBlob );

const char * AttrType2Str ( ESphAttr eAttrType );

Expand Down
1 change: 1 addition & 0 deletions src/daemon/minimize_aggr_result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ static void RecoverAggregateFunctions ( const CSphQuery & tQuery, const AggrResu
{
assert ( tCol.m_eAggrFunc==SPH_AGGR_NONE );
tCol.m_eAggrFunc = tItem.m_eAggrFunc;
tCol.m_fTdigestCompression = tItem.m_fTdigestCompression;
}
}
}
Expand Down
40 changes: 35 additions & 5 deletions src/daemon/search_handler.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2284,6 +2284,9 @@ static ESphAggrFunc GetAggr ( Aggr_e eAggrFunc )
case Aggr_e::MAX: return SPH_AGGR_MAX;
case Aggr_e::SUM: return SPH_AGGR_SUM;
case Aggr_e::AVG: return SPH_AGGR_AVG;
case Aggr_e::PERCENTILES: return SPH_AGGR_PERCENTILES;
case Aggr_e::PERCENTILE_RANKS: return SPH_AGGR_PERCENTILE_RANKS;
case Aggr_e::MAD: return SPH_AGGR_MAD;
default: return SPH_AGGR_NONE;
}
}
Expand Down Expand Up @@ -2361,8 +2364,11 @@ SearchHandler_c CreateMsearchHandler ( std::unique_ptr<QueryParser_i> pQueryPars
{
const JsonAggr_t & tBucket = tQuery.m_dAggs[i];

// add only new items
if ( hAttrs[tBucket.m_sCol] )
const bool bHasAggrFunc = ( tBucket.m_eAggrFunc!=Aggr_e::NONE );
CSphString sAlias = bHasAggrFunc ? GetAggrName ( i, tBucket.m_sCol ) : tBucket.m_sCol;

// add only new items (by alias)
if ( hAttrs[sAlias] )
continue;

if ( tBucket.m_eAggrFunc==Aggr_e::COUNT )
Expand All @@ -2378,14 +2384,22 @@ SearchHandler_c CreateMsearchHandler ( std::unique_ptr<QueryParser_i> pQueryPars
if ( tBucket.m_eAggrFunc!=Aggr_e::NONE )
{
tItem.m_sExpr = DumpAggr ( tBucket.m_sCol.cstr(), tBucket );
tItem.m_sAlias = GetAggrName ( i, tBucket.m_sCol );
tItem.m_sAlias = sAlias;
tItem.m_eAggrFunc = GetAggr ( tBucket.m_eAggrFunc );
switch ( tBucket.m_eAggrFunc )
{
case Aggr_e::PERCENTILES: tItem.m_fTdigestCompression = tBucket.m_tPercentiles.m_fCompression; break;
case Aggr_e::PERCENTILE_RANKS: tItem.m_fTdigestCompression = tBucket.m_tPercentileRanks.m_fCompression; break;
case Aggr_e::MAD: tItem.m_fTdigestCompression = tBucket.m_tMad.m_fCompression; break;
default: break;
}
} else
{
tItem.m_sExpr = tBucket.m_sCol;
tItem.m_sAlias = tBucket.m_sCol;
hAttrs.Add ( tBucket.m_sCol );
tItem.m_sAlias = sAlias;
}

hAttrs.Add ( tItem.m_sAlias );
}

tQuery.m_bFacetHead = true;
Expand All @@ -2406,6 +2420,9 @@ SearchHandler_c CreateMsearchHandler ( std::unique_ptr<QueryParser_i> pQueryPars
tQuery.m_bFacet = true;

// select list to facet query
if ( tBucket.m_eAggrFunc==Aggr_e::PERCENTILES || tBucket.m_eAggrFunc==Aggr_e::PERCENTILE_RANKS || tBucket.m_eAggrFunc==Aggr_e::MAD )
tQuery.m_sSelect = DumpAggr ( tBucket.m_sCol.cstr(), tBucket );
else
tQuery.m_sSelect.SetSprintf ( "%s", tBucket.m_sCol.cstr() );

// ref items to facet query
Expand Down Expand Up @@ -2435,11 +2452,21 @@ SearchHandler_c CreateMsearchHandler ( std::unique_ptr<QueryParser_i> pQueryPars
case Aggr_e::MAX:
case Aggr_e::SUM:
case Aggr_e::AVG:
case Aggr_e::PERCENTILES:
case Aggr_e::PERCENTILE_RANKS:
case Aggr_e::MAD:
{
CSphQueryItem & tItem = tQuery.m_dRefItems.Add();
tItem.m_sExpr = DumpAggr ( tBucket.m_sCol.cstr(), tBucket );
tItem.m_sAlias = GetAggrName ( i, tBucket.m_sCol );
tItem.m_eAggrFunc = GetAggr ( tBucket.m_eAggrFunc );
switch ( tBucket.m_eAggrFunc )
{
case Aggr_e::PERCENTILES: tItem.m_fTdigestCompression = tBucket.m_tPercentiles.m_fCompression; break;
case Aggr_e::PERCENTILE_RANKS: tItem.m_fTdigestCompression = tBucket.m_tPercentileRanks.m_fCompression; break;
case Aggr_e::MAD: tItem.m_fTdigestCompression = tBucket.m_tMad.m_fCompression; break;
default: break;
}
}
break;

Expand Down Expand Up @@ -2473,6 +2500,9 @@ SearchHandler_c CreateMsearchHandler ( std::unique_ptr<QueryParser_i> pQueryPars
case Aggr_e::MAX:
case Aggr_e::SUM:
case Aggr_e::AVG:
case Aggr_e::PERCENTILES:
case Aggr_e::PERCENTILE_RANKS:
case Aggr_e::MAD:
break;

case Aggr_e::COMPOSITE:
Expand Down
37 changes: 37 additions & 0 deletions src/queuecreator.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ class QueueCreator_c
bool m_bHeadWOGroup;
bool m_bGotDistinct;
bool m_bExprsNeedDocids = false;
bool m_bSlimTdigestCandidate = true;
bool m_bHasTdigestAgg = false;

// for sorter to create pooled attributes
bool m_bHaveStar = false;
Expand Down Expand Up @@ -352,6 +354,7 @@ class QueueCreator_c
std::unique_ptr<ISphFilter> CreateAggrFilter() const;
void SetupCollation();
bool Err ( const char * sFmt, ... ) const;
bool ShouldEnableSlimTdigest() const;
};


Expand Down Expand Up @@ -613,6 +616,7 @@ bool QueueCreator_c::SetupGroupbySettings ( bool bHasImplicitGrouping )
if ( bHasImplicitGrouping )
{
m_tGroupSorterSettings.m_bImplicit = true;
m_tGroupSorterSettings.m_bSlimTdigest = ShouldEnableSlimTdigest();
return true;
}

Expand Down Expand Up @@ -809,6 +813,18 @@ void QueueCreator_c::PropagateEvalStage ( CSphColumnInfo & tExprCol, StrVec_t &

bool QueueCreator_c::SetupAggregateExpr ( CSphColumnInfo & tExprCol, const CSphString & sExpr, DWORD uQueryPackedFactorFlags )
{
const bool bIsSlimTdigest = ( tExprCol.m_eAggrFunc==SPH_AGGR_PERCENTILES
|| tExprCol.m_eAggrFunc==SPH_AGGR_PERCENTILE_RANKS
|| tExprCol.m_eAggrFunc==SPH_AGGR_MAD );

if ( tExprCol.m_eAggrFunc!=SPH_AGGR_NONE )
{
if ( bIsSlimTdigest )
m_bHasTdigestAgg = true;
else
m_bSlimTdigestCandidate = false;
}

// validate that MAX/MIN/SUM/AVG cannot be used on string/text columns
// This check must happen BEFORE the switch statement that may modify tExprCol.m_eAttrType
if ( tExprCol.m_eAggrFunc==SPH_AGGR_MAX || tExprCol.m_eAggrFunc==SPH_AGGR_MIN
Expand All @@ -830,6 +846,13 @@ bool QueueCreator_c::SetupAggregateExpr ( CSphColumnInfo & tExprCol, const CSphS
tExprCol.m_eAttrType = SPH_ATTR_DOUBLE;
tExprCol.m_tLocator.m_iBitCount = 64;
break;
case SPH_AGGR_PERCENTILES:
case SPH_AGGR_PERCENTILE_RANKS:
case SPH_AGGR_MAD:
tExprCol.m_eAggrInputType = tExprCol.m_eAttrType;
tExprCol.m_eAttrType = SPH_ATTR_STRINGPTR;
tExprCol.m_tLocator.m_iBitCount = ROWITEMPTR_BITS;
break;

case SPH_AGGR_CAT:
// force GROUP_CONCAT() to be computed as strings
Expand Down Expand Up @@ -993,6 +1016,8 @@ bool QueueCreator_c::ParseQueryItem ( const CSphQueryItem & tItem )
const CSphString & sExpr = tItem.m_sExpr;
bool bIsCount = IsCount(sExpr);
m_bHasCount |= bIsCount;
if ( tItem.m_eAggrFunc==SPH_AGGR_NONE && !bIsCount && !IsGroupbyMagic ( sExpr ) )
m_bSlimTdigestCandidate = false;

if ( sExpr=="*" )
{
Expand Down Expand Up @@ -1098,6 +1123,7 @@ bool QueueCreator_c::ParseQueryItem ( const CSphQueryItem & tItem )
m_bZonespanlist |= bHasZonespanlist;
m_bExprsNeedDocids |= bExprsNeedDocids;
tExprCol.m_eAggrFunc = tItem.m_eAggrFunc;
tExprCol.m_fTdigestCompression = tItem.m_fTdigestCompression;
tExprCol.m_iIndex = iSorterAttr>= 0 ? m_pSorterSchema->GetAttrIndexOriginal ( tItem.m_sAlias.cstr() ) : -1;
if ( !tExprCol.m_pExpr )
return Err ( "parse error: %s", m_sError.cstr() );
Expand Down Expand Up @@ -2445,6 +2471,17 @@ ISphMatchSorter * QueueCreator_c::SpawnQueue()
}


bool QueueCreator_c::ShouldEnableSlimTdigest() const
{
if ( !m_bSlimTdigestCandidate || !m_bHasTdigestAgg )
return false;
if ( m_tQuery.m_iLimit!=0 )
return false;
if ( m_tQuery.m_bFacet || m_tQuery.m_bFacetHead )
return false;
return true;
}

bool QueueCreator_c::SetupComputeQueue ()
{
return AddJoinAttrs()
Expand Down
1 change: 1 addition & 0 deletions src/queuecreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct CSphGroupSorterSettings
CSphRefcountedPtr<CSphGrouper> m_pGrouper;///< group key calculator
CSphRefcountedPtr<DistinctFetcher_i> m_pDistinctFetcher;
bool m_bImplicit = false;///< for queries with aggregate functions but without group by clause
bool m_bSlimTdigest = false; ///< implicit TDigest-only query, allow slim match buffer
SharedPtr_t<ISphFilter> m_pAggrFilterTrait; ///< aggregate filter that got owned by grouper
bool m_bJson = false; ///< whether we're grouping by Json attribute
int m_iMaxMatches = 0;
Expand Down
1 change: 1 addition & 0 deletions src/schema/columninfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bool CSphColumnInfo::operator== ( const CSphColumnInfo & rhs ) const
{
return m_sName == rhs.m_sName
&& m_eAttrType == rhs.m_eAttrType
&& m_eAggrInputType == rhs.m_eAggrInputType
&& m_tLocator.m_iBitCount == rhs.m_tLocator.m_iBitCount
&& m_tLocator.m_iBitOffset == rhs.m_tLocator.m_iBitOffset
&& m_tLocator.m_bDynamic == rhs.m_tLocator.m_bDynamic;
Expand Down
3 changes: 3 additions & 0 deletions src/schema/columninfo.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct CSphColumnInfo

CSphString m_sName; ///< column name
ESphAttr m_eAttrType; ///< attribute type
ESphAttr m_eAggrInputType { SPH_ATTR_NONE };///< original attr type for aggregate inputs

ESphWordpart m_eWordpart { SPH_WORDPART_WHOLE }; ///< wordpart processing type
bool m_bIndexed = false; ///< whether to index this column as fulltext field too
Expand All @@ -77,6 +78,8 @@ struct CSphColumnInfo
knn::ModelSettings_t m_tKNNModel; ///< knn model settings
CSphString m_sKNNFrom; ///< fields/attrs used by the model

double m_fTdigestCompression = 200.0; ///< tdigest compression for extended aggs

WORD m_uNext = 0xFFFF; ///< next in linked list for hash in CSphSchema

/// handy ctor
Expand Down
Loading