fixed issue with interplay between count(*) and _id column (#2250)

This commit is contained in:
Pat Okeeffe 2023-02-14 18:40:15 -06:00 committed by GitHub
parent 6bf693b98c
commit f205459003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -644,7 +644,13 @@ func tryToReplaceGroupByWithPQLAggregate(ctx context.Context, a *ExecutionPlanne
}
switch aggregable.AggExpression().Type().(type) {
case *parser.DataTypeID, *parser.DataTypeString:
return thisNode, true, nil
// if it is any other column other than _id bail
ref, ok := aggregable.AggExpression().(*qualifiedRefPlanExpression)
if ok {
if !strings.EqualFold(ref.columnName, "_id") {
return thisNode, true, nil
}
}
}
}