Skip to content

Commit

Permalink
remove PreProcess: true from plan descriptions
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <andres@planetscale.com>
  • Loading branch information
systay committed Apr 12, 2021
1 parent b8fbf73 commit 96ff78f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
9 changes: 3 additions & 6 deletions go/vt/vtgate/engine/ordered_aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var _ Primitive = (*OrderedAggregate)(nil)
// is that the underlying primitive is a scatter select with pre-sorted
// rows.
type OrderedAggregate struct {
// PreProcess is true if one of the aggregates is distinct.
// PreProcess is true if one of the aggregates needs preprocessing.
PreProcess bool `json:",omitempty"`
// Aggregates specifies the aggregation parameters for each
// aggregation function: function opcode and input column number.
Expand Down Expand Up @@ -69,7 +69,7 @@ func (ap AggregateParams) isDistinct() bool {
return ap.Opcode == AggregateCountDistinct || ap.Opcode == AggregateSumDistinct
}

func (ap AggregateParams) changeField() bool {
func (ap AggregateParams) preProcess() bool {
return ap.Opcode == AggregateCountDistinct || ap.Opcode == AggregateSumDistinct || ap.Opcode == AggregateGtid
}

Expand Down Expand Up @@ -279,7 +279,7 @@ func (oa *OrderedAggregate) convertFields(fields []*querypb.Field) []*querypb.Fi
return fields
}
for _, aggr := range oa.Aggregates {
if !aggr.changeField() {
if !aggr.preProcess() {
continue
}
fields[aggr.Col] = &querypb.Field{
Expand Down Expand Up @@ -457,9 +457,6 @@ func (oa *OrderedAggregate) description() PrimitiveDescription {
"Aggregates": aggregates,
"GroupBy": groupBy,
}
if oa.PreProcess {
other["PreProcess"] = true
}

return PrimitiveDescription{
OperatorType: "Aggregate",
Expand Down
5 changes: 0 additions & 5 deletions go/vt/vtgate/planbuilder/testdata/aggr_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,6 @@ Gen4 plan same as above
"Variant": "Ordered",
"Aggregates": "count_distinct(1) AS count(distinct col2)",
"GroupBy": "0",
"PreProcess": true,
"Inputs": [
{
"OperatorType": "Route",
Expand All @@ -728,7 +727,6 @@ Gen4 plan same as above
"OperatorType": "Aggregate",
"Variant": "Ordered",
"Aggregates": "count_distinct(0) AS count(distinct col2)",
"PreProcess": true,
"Inputs": [
{
"OperatorType": "Route",
Expand Down Expand Up @@ -756,7 +754,6 @@ Gen4 plan same as above
"Variant": "Ordered",
"Aggregates": "count_distinct(1) AS c2",
"GroupBy": "0",
"PreProcess": true,
"Inputs": [
{
"OperatorType": "Route",
Expand Down Expand Up @@ -784,7 +781,6 @@ Gen4 plan same as above
"Variant": "Ordered",
"Aggregates": "sum_distinct(1) AS sum(distinct col2)",
"GroupBy": "0",
"PreProcess": true,
"Inputs": [
{
"OperatorType": "Route",
Expand Down Expand Up @@ -844,7 +840,6 @@ Gen4 plan same as above
"Variant": "Ordered",
"Aggregates": "count_distinct(1) AS k",
"GroupBy": "0",
"PreProcess": true,
"Inputs": [
{
"OperatorType": "Route",
Expand Down
1 change: 0 additions & 1 deletion go/vt/vtgate/planbuilder/testdata/show_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@
"OperatorType": "Aggregate",
"Variant": "Ordered",
"Aggregates": "vgtid(1) AS global vgtid_executed",
"PreProcess": true,
"Inputs": [
{
"OperatorType": "Send",
Expand Down

0 comments on commit 96ff78f

Please sign in to comment.