Skip to content

Commit

Permalink
feat: enable pushdowns for sum, count, min, and max by default (#19227)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlapacik authored Aug 5, 2020
1 parent 1891479 commit 46c7345
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 155 deletions.
4 changes: 0 additions & 4 deletions cmd/influxd/launcher/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2316,11 +2316,7 @@ from(bucket: v.bucket)
tc := tc
t.Run(tc.name, func(t *testing.T) {
l := launcher.RunTestLauncherOrFail(t, ctx, mock.NewFlagger(map[feature.Flag]interface{}{
feature.PushDownWindowAggregateCount(): true,
feature.PushDownWindowAggregateSum(): true,
feature.PushDownWindowAggregateMean(): true,
feature.PushDownWindowAggregateMin(): true,
feature.PushDownWindowAggregateMax(): true,
feature.PushDownGroupAggregateMinMax(): true,
}))

Expand Down
24 changes: 0 additions & 24 deletions flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,6 @@
contact: Gavin Cabbage
expose: true

- name: Push Down Window Aggregate Count
description: Enable Count variant of PushDownWindowAggregateRule and PushDownBareAggregateRule
key: pushDownWindowAggregateCount
default: false
contact: Query Team

- name: Push Down Window Aggregate Sum
description: Enable Sum variant of PushDownWindowAggregateRule and PushDownBareAggregateRule
key: pushDownWindowAggregateSum
default: false
contact: Query Team

- name: Push Down Window Aggregate Min
description: Enable Min variant of PushDownWindowAggregateRule and PushDownBareAggregateRule
key: pushDownWindowAggregateMin
default: false
contact: Query Team

- name: Push Down Window Aggregate Max
description: Enable Max variant of PushDownWindowAggregateRule and PushDownBareAggregateRule
key: pushDownWindowAggregateMax
default: false
contact: Query Team

- name: Push Down Window Aggregate Mean
description: Enable Mean variant of PushDownWindowAggregateRule and PushDownBareAggregateRule
key: pushDownWindowAggregateMean
Expand Down
64 changes: 0 additions & 64 deletions kit/feature/list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions query/stdlib/influxdata/influxdb/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,15 +687,15 @@ func canPushWindowedAggregate(ctx context.Context, fnNode plan.Node) bool {
// and check the feature flag associated with the aggregate function.
switch fnNode.Kind() {
case universe.MinKind:
if !feature.PushDownWindowAggregateMin().Enabled(ctx) || !caps.HaveMin() {
if !caps.HaveMin() {
return false
}
minSpec := fnNode.ProcedureSpec().(*universe.MinProcedureSpec)
if minSpec.Column != execute.DefaultValueColLabel {
return false
}
case universe.MaxKind:
if !feature.PushDownWindowAggregateMax().Enabled(ctx) || !caps.HaveMax() {
if !caps.HaveMax() {
return false
}
maxSpec := fnNode.ProcedureSpec().(*universe.MaxProcedureSpec)
Expand All @@ -711,15 +711,15 @@ func canPushWindowedAggregate(ctx context.Context, fnNode plan.Node) bool {
return false
}
case universe.CountKind:
if !feature.PushDownWindowAggregateCount().Enabled(ctx) || !caps.HaveCount() {
if !caps.HaveCount() {
return false
}
countSpec := fnNode.ProcedureSpec().(*universe.CountProcedureSpec)
if len(countSpec.Columns) != 1 || countSpec.Columns[0] != execute.DefaultValueColLabel {
return false
}
case universe.SumKind:
if !feature.PushDownWindowAggregateSum().Enabled(ctx) || !caps.HaveSum() {
if !caps.HaveSum() {
return false
}
sumSpec := fnNode.ProcedureSpec().(*universe.SumProcedureSpec)
Expand Down
31 changes: 2 additions & 29 deletions query/stdlib/influxdata/influxdb/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1209,11 +1209,7 @@ func meanProcedureSpec() *universe.MeanProcedureSpec {
func TestPushDownWindowAggregateRule(t *testing.T) {
// Turn on all variants.
flagger := mock.NewFlagger(map[feature.Flag]interface{}{
feature.PushDownWindowAggregateCount(): true,
feature.PushDownWindowAggregateSum(): true,
feature.PushDownWindowAggregateMin(): true,
feature.PushDownWindowAggregateMax(): true,
feature.PushDownWindowAggregateMean(): true,
feature.PushDownWindowAggregateMean(): true,
})

withFlagger, _ := feature.Annotate(context.Background(), flagger)
Expand Down Expand Up @@ -1955,10 +1951,6 @@ func TestTransposeGroupToWindowAggregateRule(t *testing.T) {
// Turn on all variants.
flagger := mock.NewFlagger(map[feature.Flag]interface{}{
feature.GroupWindowAggregateTranspose(): true,
feature.PushDownWindowAggregateCount(): true,
feature.PushDownWindowAggregateSum(): true,
feature.PushDownWindowAggregateMin(): true,
feature.PushDownWindowAggregateMax(): true,
feature.PushDownWindowAggregateMean(): true,
})

Expand Down Expand Up @@ -2507,10 +2499,7 @@ func TestTransposeGroupToWindowAggregateRule(t *testing.T) {

func TestPushDownBareAggregateRule(t *testing.T) {
// Turn on support for window aggregate count
flagger := mock.NewFlagger(map[feature.Flag]interface{}{
feature.PushDownWindowAggregateCount(): true,
feature.PushDownWindowAggregateSum(): true,
})
flagger := mock.NewFlagger(map[feature.Flag]interface{}{})

withFlagger, _ := feature.Annotate(context.Background(), flagger)

Expand Down Expand Up @@ -2640,22 +2629,6 @@ func TestPushDownBareAggregateRule(t *testing.T) {
},
NoChange: true,
},
{
// unsupported aggregate
Context: haveCaps,
Name: "no push down min",
Rules: []plan.Rule{influxdb.PushDownBareAggregateRule{}},
Before: &plantest.PlanSpec{
Nodes: []plan.Node{
plan.CreatePhysicalNode("ReadRange", readRange),
plan.CreatePhysicalNode("count", minProcedureSpec()),
},
Edges: [][2]int{
{0, 1},
},
},
NoChange: true,
},
}

for _, tc := range testcases {
Expand Down
30 changes: 0 additions & 30 deletions query/stdlib/testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,42 +155,12 @@ type PerTestFeatureFlagMap = map[string]map[string]map[string]string

var FluxEndToEndFeatureFlags = PerTestFeatureFlagMap{
"planner": {
"window_count_push": {
"pushDownWindowAggregateCount": "true",
},
"window_sum_push": {
"pushDownWindowAggregateSum": "true",
},
"bare_count_push": {
"pushDownWindowAggregateCount": "true",
},
"bare_sum_push": {
"pushDownWindowAggregateSum": "true",
},
"bare_mean_push": {
"pushDownWindowAggregateMean": "true",
},
"window_mean_push": {
"pushDownWindowAggregateMean": "true",
},
"bare_min_push": {
"pushDownWindowAggregateMin": "true",
},
"window_min_push": {
"pushDownWindowAggregateMin": "true",
},
"aggregate_window_min_push": {
"pushDownWindowAggregateMin": "true",
},
"bare_max_push": {
"pushDownWindowAggregateMax": "true",
},
"window_max_push": {
"pushDownWindowAggregateMax": "true",
},
"aggregate_window_max_push": {
"pushDownWindowAggregateMax": "true",
},
"merge_filters": {
"mergeFilterRule": "true",
},
Expand Down

0 comments on commit 46c7345

Please sign in to comment.