Skip to content

Commit

Permalink
Signed-off-by: Song Gao <[email protected]>
Browse files Browse the repository at this point in the history
fix

Signed-off-by: Song Gao <[email protected]>

fix

Signed-off-by: Song Gao <[email protected]>
  • Loading branch information
Yisaer committed Dec 26, 2024
1 parent 17f5887 commit 76d3b9c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ build_prepare:
.PHONY: build_without_edgex
build_without_edgex: build_prepare
GO111MODULE=on CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X github.com/lf-edge/ekuiper/v2/cmd.Version=$(VERSION) -X github.com/lf-edge/ekuiper/v2/cmd.LoadFileType=relative" -o kuiper cmd/kuiper/main.go
GO111MODULE=on CGO_ENABLED=1 go build -trimpath -ldflags="-s -w -X github.com/lf-edge/ekuiper/v2/cmd.Version=$(VERSION) -X github.com/lf-edge/ekuiper/v2/cmd.LoadFileType=relative" -o kuiperd cmd/kuiperd/main.go
GO111MODULE=on CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X github.com/lf-edge/ekuiper/v2/cmd.Version=$(VERSION) -X github.com/lf-edge/ekuiper/v2/cmd.LoadFileType=relative" -o kuiperd cmd/kuiperd/main.go
@if [ "$$(uname -s)" = "Linux" ] && [ ! -z $$(which upx) ]; then upx ./kuiper; upx ./kuiperd; fi
@mv ./kuiper ./kuiperd $(BUILD_PATH)/$(PACKAGE_NAME)/bin
@echo "Build successfully"
Expand Down
10 changes: 4 additions & 6 deletions internal/pkg/def/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ type RuleOption struct {
type PlanOptimizeStrategy struct {
EnableIncrementalWindow bool `json:"enableIncrementalWindow,omitempty" yaml:"enableIncrementalWindow,omitempty"`
EnableAliasPushdown bool `json:"enableAliasPushdown,omitempty" yaml:"enableAliasPushdown,omitempty"`
EnableAliasRefCal bool `json:"enableAliasRefCal,omitempty" yaml:"enableAliasRefCal,omitempty"`
DisableAliasRefCal bool `json:"disableAliasRefCal,omitempty" yaml:"disableAliasRefCal,omitempty"`
}

func (p *PlanOptimizeStrategy) IsAliasRefCalEnable() bool {
if p == nil {
return false
return true
}
return p.EnableAliasRefCal
return !p.DisableAliasRefCal
}

type RestartStrategy struct {
Expand Down Expand Up @@ -148,9 +148,7 @@ func GetDefaultRule(name, sql string) *Rule {
MaxDelay: 30000,
JitterFactor: 0.1,
},
PlanOptimizeStrategy: &PlanOptimizeStrategy{
EnableAliasRefCal: true,
},
PlanOptimizeStrategy: &PlanOptimizeStrategy{},
},
}
}
Expand Down
1 change: 0 additions & 1 deletion internal/topo/planner/plan_explain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func TestExplainPlan(t *testing.T) {
p, err := createLogicalPlan(stmt, &def.RuleOption{
PlanOptimizeStrategy: &def.PlanOptimizeStrategy{
EnableIncrementalWindow: true,
EnableAliasRefCal: true,
},
Qos: 0,
}, kv)
Expand Down
20 changes: 9 additions & 11 deletions internal/topo/planner/planner_alias_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,15 @@ func TestPlannerAlias(t *testing.T) {
continue
}
p, _ := createLogicalPlan(stmt, &def.RuleOption{
IsEventTime: false,
LateTol: 0,
Concurrency: 0,
BufferLength: 0,
SendMetaToSink: false,
Qos: 0,
CheckpointInterval: 0,
SendError: true,
PlanOptimizeStrategy: &def.PlanOptimizeStrategy{
EnableAliasRefCal: true,
},
IsEventTime: false,
LateTol: 0,
Concurrency: 0,
BufferLength: 0,
SendMetaToSink: false,
Qos: 0,
CheckpointInterval: 0,
SendError: true,
PlanOptimizeStrategy: &def.PlanOptimizeStrategy{},
}, kv)
if !reflect.DeepEqual(tt.p, p) {
t.Errorf("%d. %q\n\nstmt mismatch:\n\nexp=%#v\n\ngot=%#v\n\n", i, tt.sql, render.AsCode(tt.p), render.AsCode(p))
Expand Down
3 changes: 0 additions & 3 deletions internal/topo/planner/planner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2570,9 +2570,6 @@ func Test_createLogicalPlan(t *testing.T) {
Qos: 0,
CheckpointInterval: 0,
SendError: true,
PlanOptimizeStrategy: &def.PlanOptimizeStrategy{
EnableAliasRefCal: true,
},
}, kv)
if tt.err != "" {
assert.EqualError(t, err, tt.err)
Expand Down
9 changes: 0 additions & 9 deletions internal/topo/topotest/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,6 @@ func TestSingleSQL(t *testing.T) {
SendError: true,
PlanOptimizeStrategy: &def.PlanOptimizeStrategy{
EnableIncrementalWindow: true,
EnableAliasRefCal: true,
},
},
{
Expand All @@ -1258,7 +1257,6 @@ func TestSingleSQL(t *testing.T) {
CheckpointInterval: cast.DurationConf(5 * time.Second),
PlanOptimizeStrategy: &def.PlanOptimizeStrategy{
EnableIncrementalWindow: true,
EnableAliasRefCal: true,
},
},
{
Expand All @@ -1268,7 +1266,6 @@ func TestSingleSQL(t *testing.T) {
CheckpointInterval: cast.DurationConf(5 * time.Second),
PlanOptimizeStrategy: &def.PlanOptimizeStrategy{
EnableIncrementalWindow: true,
EnableAliasRefCal: true,
},
},
}
Expand Down Expand Up @@ -1864,18 +1861,12 @@ func TestAliasSQL(t *testing.T) {
SendError: true,
Qos: def.AtLeastOnce,
CheckpointInterval: cast.DurationConf(5 * time.Second),
PlanOptimizeStrategy: &def.PlanOptimizeStrategy{
EnableAliasRefCal: true,
},
},
{
BufferLength: 100,
SendError: true,
Qos: def.ExactlyOnce,
CheckpointInterval: cast.DurationConf(5 * time.Second),
PlanOptimizeStrategy: &def.PlanOptimizeStrategy{
EnableAliasRefCal: true,
},
},
}
for _, opt := range options {
Expand Down

0 comments on commit 76d3b9c

Please sign in to comment.