forked from milvus-io/milvus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement json visitor for plan node (milvus-io#22897)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
- Loading branch information
1 parent
348fba4
commit ce2c5d1
Showing
15 changed files
with
800 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package optimizer | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/milvus-io/milvus/internal/mysqld/planner" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_defaultCBO_Optimize(t *testing.T) { | ||
cbo := NewDefaultCBO() | ||
plan := &planner.PhysicalPlan{} | ||
optimized := cbo.Optimize(plan) | ||
assert.Same(t, plan, optimized) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package optimizer | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/milvus-io/milvus/internal/mysqld/planner" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_defaultRBO_Optimize(t *testing.T) { | ||
rbo := NewDefaultRBO() | ||
plan := &planner.LogicalPlan{} | ||
optimized := rbo.Optimize(plan) | ||
assert.Same(t, plan, optimized) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
internal/mysqld/parser/antlrparser/node_ret_wrong_var_naming.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package antlrparser | ||
|
||
import "github.com/milvus-io/milvus/internal/mysqld/planner" | ||
|
||
func GetSqlStatements(obj interface{}) *planner.NodeSqlStatements { | ||
n, ok := obj.(*planner.NodeSqlStatements) | ||
if !ok { | ||
return nil | ||
} | ||
return n | ||
} | ||
|
||
func GetSqlStatement(obj interface{}) *planner.NodeSqlStatement { | ||
n, ok := obj.(*planner.NodeSqlStatement) | ||
if !ok { | ||
return nil | ||
} | ||
return n | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package parser | ||
|
||
import "testing" | ||
|
||
func TestConfig_Apply(t *testing.T) { | ||
opts := []Option{ | ||
func(c *Config) { | ||
}, | ||
func(c *Config) { | ||
}, | ||
} | ||
c := defaultParserConfig() | ||
c.Apply(opts...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package planner | ||
|
||
import "reflect" | ||
|
||
func Equal(n1, n2 Node) bool { | ||
v := NewJSONVisitor() | ||
j1, j2 := n1.Accept(v), n2.Accept(v) | ||
return reflect.DeepEqual(j1, j2) | ||
} |
Oops, something went wrong.