Skip to content
Merged
Changes from 1 commit
Commits
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
13 changes: 13 additions & 0 deletions src/queuecreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,19 @@ bool QueueCreator_c::SetupAggregateExpr ( CSphColumnInfo & tExprCol, const CSphS
if ( tExprCol.m_eAggrFunc!=SPH_AGGR_NONE && tExprCol.m_eAttrType==SPH_ATTR_JSON_FIELD )
return Err ( "ambiguous attribute type '%s', use INTEGER(), BIGINT() or DOUBLE() conversion functions", sExpr.cstr() );

// validate that MAX/MIN/SUM/AVG cannot be used on string/text columns
if ( tExprCol.m_eAggrFunc==SPH_AGGR_MAX || tExprCol.m_eAggrFunc==SPH_AGGR_MIN
|| tExprCol.m_eAggrFunc==SPH_AGGR_SUM || tExprCol.m_eAggrFunc==SPH_AGGR_AVG )
{
if ( tExprCol.m_eAttrType==SPH_ATTR_STRING || tExprCol.m_eAttrType==SPH_ATTR_STRINGPTR )
{
const char * sFunc = ( tExprCol.m_eAggrFunc==SPH_AGGR_MAX ) ? "MAX"
: ( tExprCol.m_eAggrFunc==SPH_AGGR_MIN ) ? "MIN"
: ( tExprCol.m_eAggrFunc==SPH_AGGR_SUM ) ? "SUM" : "AVG";
return Err ( "%s() cannot be used on text/string column '%s'", sFunc, sExpr.cstr() );
}
}

if ( uQueryPackedFactorFlags & SPH_FACTOR_JSON_OUT )
tExprCol.m_eAttrType = SPH_ATTR_FACTORS_JSON;

Expand Down
Loading