*: Enable distributed count with TiKV (#1312)

Push down count to TiKV
This commit is contained in:
Shen Li
2016-06-13 10:09:09 +08:00
committed by GitHub
parent 991428a998
commit e953dee8bb
4 changed files with 10 additions and 7 deletions

View File

@ -377,9 +377,6 @@ func (b *executorBuilder) buildAggregate(v *plan.Aggregate) Executor {
return nil
}
client := txn.GetClient()
if !client.SupportRequestType(kv.ReqTypeSelect, kv.ReqSubTypeAgg) {
return e
}
if len(v.GroupByItems) > 0 && !client.SupportRequestType(kv.ReqTypeSelect, kv.ReqSubTypeGroupBy) {
return e
}

View File

@ -111,8 +111,7 @@ const (
ReqSubTypeBasic = 0
ReqSubTypeDesc = 10000
ReqSubTypeAgg = 10001
ReqSubTypeGroupBy = 10002
ReqSubTypeGroupBy = 10001
)
// KeyRange represents a range where StartKey <= key < EndKey.

View File

@ -39,7 +39,7 @@ func (c *dbClient) SupportRequestType(reqType, subType int64) bool {
switch reqType {
case kv.ReqTypeSelect:
switch subType {
case kv.ReqSubTypeAgg:
case kv.ReqSubTypeGroupBy:
return true
default:
return supportExpr(tipb.ExprType(subType))

View File

@ -37,7 +37,12 @@ type CopClient struct {
func (c *CopClient) SupportRequestType(reqType, subType int64) bool {
switch reqType {
case kv.ReqTypeSelect:
return supportExpr(tipb.ExprType(subType))
switch subType {
case kv.ReqSubTypeGroupBy:
return true
default:
return supportExpr(tipb.ExprType(subType))
}
case kv.ReqTypeIndex:
switch subType {
case kv.ReqSubTypeDesc, kv.ReqSubTypeBasic:
@ -58,6 +63,8 @@ func supportExpr(exprType tipb.ExprType) bool {
tipb.ExprType_In, tipb.ExprType_ValueList,
tipb.ExprType_Like, tipb.ExprType_Not:
return true
case tipb.ExprType_Count:
return true
case kv.ReqSubTypeDesc:
return true
default: