Skip to content

Commit

Permalink
rename engine primitive
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
systay authored and frouioui committed Jan 8, 2025
1 parent f584098 commit d25b47e
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 57 deletions.
86 changes: 43 additions & 43 deletions go/vt/vtgate/engine/cached_size.go

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

27 changes: 14 additions & 13 deletions go/vt/vtgate/engine/join_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ import (
querypb "vitess.io/vitess/go/vt/proto/query"
)

var _ Primitive = (*JoinValues)(nil)
var _ Primitive = (*ValuesJoin)(nil)

// JoinValues is a primitive that joins two primitives by constructing a table from the rows of the LHS primitive.
// ValuesJoin is a primitive that joins two primitives by constructing a table from the rows of the LHS primitive.
// The table is passed in as a bind variable to the RHS primitive.
type JoinValues struct {
// It's called ValuesJoin because the LHS of the join is sent to the RHS as a VALUES clause.
type ValuesJoin struct {
// Left and Right are the LHS and RHS primitives
// of the Join. They can be any primitive.
Left, Right Primitive
Expand All @@ -38,7 +39,7 @@ type JoinValues struct {
}

// TryExecute performs a non-streaming exec.
func (jv *JoinValues) TryExecute(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
func (jv *ValuesJoin) TryExecute(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
lresult, err := vcursor.ExecutePrimitive(ctx, jv.Left, bindVars, wantfields)
if err != nil {
return nil, err
Expand Down Expand Up @@ -69,44 +70,44 @@ func (jv *JoinValues) TryExecute(ctx context.Context, vcursor VCursor, bindVars
}

// TryStreamExecute performs a streaming exec.
func (jv *JoinValues) TryStreamExecute(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
func (jv *ValuesJoin) TryStreamExecute(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
panic("implement me")
}

// GetFields fetches the field info.
func (jv *JoinValues) GetFields(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
func (jv *ValuesJoin) GetFields(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
return jv.Right.GetFields(ctx, vcursor, bindVars)
}

// Inputs returns the input primitives for this join
func (jv *JoinValues) Inputs() ([]Primitive, []map[string]any) {
func (jv *ValuesJoin) Inputs() ([]Primitive, []map[string]any) {
return []Primitive{jv.Left, jv.Right}, nil
}

// RouteType returns a description of the query routing type used by the primitive
func (jv *JoinValues) RouteType() string {
return "JoinValues"
func (jv *ValuesJoin) RouteType() string {
return "ValuesJoin"
}

// GetKeyspaceName specifies the Keyspace that this primitive routes to.
func (jv *JoinValues) GetKeyspaceName() string {
func (jv *ValuesJoin) GetKeyspaceName() string {
if jv.Left.GetKeyspaceName() == jv.Right.GetKeyspaceName() {
return jv.Left.GetKeyspaceName()
}
return jv.Left.GetKeyspaceName() + "_" + jv.Right.GetKeyspaceName()
}

// GetTableName specifies the table that this primitive routes to.
func (jv *JoinValues) GetTableName() string {
func (jv *ValuesJoin) GetTableName() string {
return jv.Left.GetTableName() + "_" + jv.Right.GetTableName()
}

// NeedsTransaction implements the Primitive interface
func (jv *JoinValues) NeedsTransaction() bool {
func (jv *ValuesJoin) NeedsTransaction() bool {
return jv.Right.NeedsTransaction() || jv.Left.NeedsTransaction()
}

func (jv *JoinValues) description() PrimitiveDescription {
func (jv *ValuesJoin) description() PrimitiveDescription {
return PrimitiveDescription{
OperatorType: "Join",
Variant: "Values",
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operator_transformers.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func transformValuesJoin(ctx *plancontext.PlanningContext, op *operators.ValuesJ
return nil, err
}

return &engine.JoinValues{
return &engine.ValuesJoin{
Left: lhs,
Right: rhs,
Vars: op.Vars,
Expand Down

0 comments on commit d25b47e

Please sign in to comment.