vitess.io/vitess@v0.16.2/go/vt/vtgate/planbuilder/primitive_wrapper.go (about)

     1  /*
     2  Copyright 2022 The Vitess Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package planbuilder
    18  
    19  import (
    20  	"vitess.io/vitess/go/vt/sqlparser"
    21  	"vitess.io/vitess/go/vt/vterrors"
    22  	"vitess.io/vitess/go/vt/vtgate/engine"
    23  	"vitess.io/vitess/go/vt/vtgate/planbuilder/plancontext"
    24  	"vitess.io/vitess/go/vt/vtgate/semantics"
    25  )
    26  
    27  // primitiveWrapper is used when only need a logical plan that supports plan.Primitive() and nothing else
    28  type primitiveWrapper struct {
    29  	prim engine.Primitive
    30  	gen4Plan
    31  }
    32  
    33  func (p *primitiveWrapper) WireupGen4(*plancontext.PlanningContext) error {
    34  	return nil
    35  }
    36  
    37  func (p *primitiveWrapper) Primitive() engine.Primitive {
    38  	return p.prim
    39  }
    40  
    41  func (p *primitiveWrapper) Inputs() []logicalPlan {
    42  	return nil
    43  }
    44  
    45  func (p *primitiveWrapper) Rewrite(...logicalPlan) error {
    46  	return vterrors.VT13001("cannot rewrite")
    47  }
    48  
    49  func (p *primitiveWrapper) ContainsTables() semantics.TableSet {
    50  	return semantics.EmptyTableSet()
    51  }
    52  
    53  func (p *primitiveWrapper) OutputColumns() []sqlparser.SelectExpr {
    54  	return nil
    55  }
    56  
    57  var _ logicalPlan = (*primitiveWrapper)(nil)