github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/bench/stub_factory.go (about) 1 // Copyright 2018 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package bench 12 13 import ( 14 "github.com/cockroachdb/cockroach/pkg/geo/geoindex" 15 "github.com/cockroachdb/cockroach/pkg/sql/opt" 16 "github.com/cockroachdb/cockroach/pkg/sql/opt/cat" 17 "github.com/cockroachdb/cockroach/pkg/sql/opt/constraint" 18 "github.com/cockroachdb/cockroach/pkg/sql/opt/exec" 19 "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" 20 "github.com/cockroachdb/cockroach/pkg/sql/sqlbase" 21 ) 22 23 // stubFactory is a do-nothing implementation of exec.Factory, used for testing. 24 type stubFactory struct{} 25 26 var _ exec.Factory = &stubFactory{} 27 28 func (f *stubFactory) ConstructValues( 29 rows [][]tree.TypedExpr, cols sqlbase.ResultColumns, 30 ) (exec.Node, error) { 31 return struct{}{}, nil 32 } 33 34 func (f *stubFactory) ConstructScan( 35 table cat.Table, 36 index cat.Index, 37 needed exec.TableColumnOrdinalSet, 38 indexConstraint *constraint.Constraint, 39 hardLimit int64, 40 softLimit int64, 41 reverse bool, 42 maxResults uint64, 43 reqOrdering exec.OutputOrdering, 44 rowCount float64, 45 locking *tree.LockingItem, 46 ) (exec.Node, error) { 47 return struct{}{}, nil 48 } 49 50 func (f *stubFactory) ConstructFilter( 51 n exec.Node, filter tree.TypedExpr, reqOrdering exec.OutputOrdering, 52 ) (exec.Node, error) { 53 return struct{}{}, nil 54 } 55 56 func (f *stubFactory) ConstructSimpleProject( 57 n exec.Node, cols []exec.NodeColumnOrdinal, colNames []string, reqOrdering exec.OutputOrdering, 58 ) (exec.Node, error) { 59 return struct{}{}, nil 60 } 61 62 func (f *stubFactory) ConstructRender( 63 n exec.Node, 64 columns sqlbase.ResultColumns, 65 exprs tree.TypedExprs, 66 reqOrdering exec.OutputOrdering, 67 ) (exec.Node, error) { 68 return struct{}{}, nil 69 } 70 71 func (f *stubFactory) ConstructHashJoin( 72 joinType sqlbase.JoinType, 73 left, right exec.Node, 74 leftEqCols, rightEqCols []exec.NodeColumnOrdinal, 75 leftEqColsAreKey, rightEqColsAreKey bool, 76 extraOnCond tree.TypedExpr, 77 ) (exec.Node, error) { 78 return struct{}{}, nil 79 } 80 81 func (f *stubFactory) ConstructApplyJoin( 82 joinType sqlbase.JoinType, 83 left exec.Node, 84 rightColumns sqlbase.ResultColumns, 85 onCond tree.TypedExpr, 86 planRightSideFn exec.ApplyJoinPlanRightSideFn, 87 ) (exec.Node, error) { 88 return struct{}{}, nil 89 } 90 91 func (f *stubFactory) ConstructMergeJoin( 92 joinType sqlbase.JoinType, 93 left, right exec.Node, 94 onCond tree.TypedExpr, 95 leftOrdering, rightOrdering sqlbase.ColumnOrdering, 96 reqOrdering exec.OutputOrdering, 97 leftEqColsAreKey, rightEqColsAreKey bool, 98 ) (exec.Node, error) { 99 return struct{}{}, nil 100 } 101 102 func (f *stubFactory) ConstructGroupBy( 103 input exec.Node, 104 groupCols []exec.NodeColumnOrdinal, 105 groupColOrdering sqlbase.ColumnOrdering, 106 aggregations []exec.AggInfo, 107 reqOrdering exec.OutputOrdering, 108 ) (exec.Node, error) { 109 return struct{}{}, nil 110 } 111 112 func (f *stubFactory) ConstructScalarGroupBy( 113 input exec.Node, aggregations []exec.AggInfo, 114 ) (exec.Node, error) { 115 return struct{}{}, nil 116 } 117 118 func (f *stubFactory) ConstructDistinct( 119 input exec.Node, 120 distinctCols, orderedCols exec.NodeColumnOrdinalSet, 121 reqOrdering exec.OutputOrdering, 122 nullsAreDistinct bool, 123 errorOnDup string, 124 ) (exec.Node, error) { 125 return struct{}{}, nil 126 } 127 128 func (f *stubFactory) ConstructSetOp( 129 typ tree.UnionType, all bool, left, right exec.Node, 130 ) (exec.Node, error) { 131 return struct{}{}, nil 132 } 133 134 func (f *stubFactory) ConstructSort( 135 input exec.Node, ordering sqlbase.ColumnOrdering, alreadyOrderedPrefix int, 136 ) (exec.Node, error) { 137 return struct{}{}, nil 138 } 139 140 func (f *stubFactory) ConstructOrdinality(input exec.Node, colName string) (exec.Node, error) { 141 return struct{}{}, nil 142 } 143 144 func (f *stubFactory) ConstructIndexJoin( 145 input exec.Node, 146 table cat.Table, 147 keyCols []exec.NodeColumnOrdinal, 148 tableCols exec.TableColumnOrdinalSet, 149 reqOrdering exec.OutputOrdering, 150 ) (exec.Node, error) { 151 return struct{}{}, nil 152 } 153 154 func (f *stubFactory) ConstructLookupJoin( 155 joinType sqlbase.JoinType, 156 input exec.Node, 157 table cat.Table, 158 index cat.Index, 159 eqCols []exec.NodeColumnOrdinal, 160 eqColsAreKey bool, 161 lookupCols exec.TableColumnOrdinalSet, 162 onCond tree.TypedExpr, 163 reqOrdering exec.OutputOrdering, 164 ) (exec.Node, error) { 165 return struct{}{}, nil 166 } 167 168 func (f *stubFactory) ConstructGeoLookupJoin( 169 joinType sqlbase.JoinType, 170 geoRelationshipType geoindex.RelationshipType, 171 input exec.Node, 172 table cat.Table, 173 index cat.Index, 174 geoCol exec.NodeColumnOrdinal, 175 lookupCols exec.TableColumnOrdinalSet, 176 onCond tree.TypedExpr, 177 reqOrdering exec.OutputOrdering, 178 ) (exec.Node, error) { 179 return struct{}{}, nil 180 } 181 182 func (f *stubFactory) ConstructZigzagJoin( 183 leftTable cat.Table, 184 leftIndex cat.Index, 185 rightTable cat.Table, 186 rightIndex cat.Index, 187 leftEqCols []exec.NodeColumnOrdinal, 188 rightEqCols []exec.NodeColumnOrdinal, 189 leftCols exec.NodeColumnOrdinalSet, 190 rightCols exec.NodeColumnOrdinalSet, 191 onCond tree.TypedExpr, 192 fixedVals []exec.Node, 193 reqOrdering exec.OutputOrdering, 194 ) (exec.Node, error) { 195 return struct{}{}, nil 196 } 197 198 func (f *stubFactory) ConstructLimit( 199 input exec.Node, limit, offset tree.TypedExpr, 200 ) (exec.Node, error) { 201 return struct{}{}, nil 202 } 203 204 func (f *stubFactory) ConstructMax1Row(input exec.Node, errorText string) (exec.Node, error) { 205 return struct{}{}, nil 206 } 207 208 func (f *stubFactory) ConstructProjectSet( 209 n exec.Node, exprs tree.TypedExprs, zipCols sqlbase.ResultColumns, numColsPerGen []int, 210 ) (exec.Node, error) { 211 return struct{}{}, nil 212 } 213 214 func (f *stubFactory) ConstructWindow(n exec.Node, wi exec.WindowInfo) (exec.Node, error) { 215 return struct{}{}, nil 216 } 217 218 func (f *stubFactory) RenameColumns(input exec.Node, colNames []string) (exec.Node, error) { 219 return struct{}{}, nil 220 } 221 222 func (f *stubFactory) ConstructPlan( 223 root exec.Node, subqueries []exec.Subquery, cascades []exec.Cascade, checks []exec.Node, 224 ) (exec.Plan, error) { 225 return struct{}{}, nil 226 } 227 228 func (f *stubFactory) ConstructExplainOpt( 229 plan string, envOpts exec.ExplainEnvData, 230 ) (exec.Node, error) { 231 return struct{}{}, nil 232 } 233 234 func (f *stubFactory) ConstructExplain( 235 options *tree.ExplainOptions, stmtType tree.StatementType, plan exec.Plan, 236 ) (exec.Node, error) { 237 return struct{}{}, nil 238 } 239 240 func (f *stubFactory) ConstructShowTrace(typ tree.ShowTraceType, compact bool) (exec.Node, error) { 241 return struct{}{}, nil 242 } 243 244 func (f *stubFactory) ConstructInsert( 245 input exec.Node, 246 table cat.Table, 247 insertCols exec.TableColumnOrdinalSet, 248 returnCols exec.TableColumnOrdinalSet, 249 checks exec.CheckOrdinalSet, 250 allowAutoCommit bool, 251 skipFKChecks bool, 252 ) (exec.Node, error) { 253 return struct{}{}, nil 254 } 255 256 func (f *stubFactory) ConstructInsertFastPath( 257 rows [][]tree.TypedExpr, 258 table cat.Table, 259 insertCols exec.TableColumnOrdinalSet, 260 returnCols exec.TableColumnOrdinalSet, 261 checkCols exec.CheckOrdinalSet, 262 fkChecks []exec.InsertFastPathFKCheck, 263 ) (exec.Node, error) { 264 return struct{}{}, nil 265 } 266 267 func (f *stubFactory) ConstructUpdate( 268 input exec.Node, 269 table cat.Table, 270 fetchCols exec.TableColumnOrdinalSet, 271 updateCols exec.TableColumnOrdinalSet, 272 returnCols exec.TableColumnOrdinalSet, 273 checks exec.CheckOrdinalSet, 274 passthrough sqlbase.ResultColumns, 275 allowAutoCommit bool, 276 skipFKChecks bool, 277 ) (exec.Node, error) { 278 return struct{}{}, nil 279 } 280 281 func (f *stubFactory) ConstructUpsert( 282 input exec.Node, 283 table cat.Table, 284 canaryCol exec.NodeColumnOrdinal, 285 insertCols exec.TableColumnOrdinalSet, 286 fetchCols exec.TableColumnOrdinalSet, 287 updateCols exec.TableColumnOrdinalSet, 288 returnCols exec.TableColumnOrdinalSet, 289 checks exec.CheckOrdinalSet, 290 allowAutoCommit bool, 291 skipFKChecks bool, 292 ) (exec.Node, error) { 293 return struct{}{}, nil 294 } 295 296 func (f *stubFactory) ConstructDelete( 297 input exec.Node, 298 table cat.Table, 299 fetchCols exec.TableColumnOrdinalSet, 300 returnCols exec.TableColumnOrdinalSet, 301 allowAutoCommit bool, 302 skipFKChecks bool, 303 ) (exec.Node, error) { 304 return struct{}{}, nil 305 } 306 307 func (f *stubFactory) ConstructDeleteRange( 308 table cat.Table, 309 needed exec.TableColumnOrdinalSet, 310 indexConstraint *constraint.Constraint, 311 interleavedTables []cat.Table, 312 maxReturnedKeys int, 313 allowAutoCommit bool, 314 ) (exec.Node, error) { 315 return struct{}{}, nil 316 } 317 318 func (f *stubFactory) ConstructCreateTable( 319 input exec.Node, schema cat.Schema, ct *tree.CreateTable, 320 ) (exec.Node, error) { 321 return struct{}{}, nil 322 } 323 324 func (f *stubFactory) ConstructSequenceSelect(seq cat.Sequence) (exec.Node, error) { 325 return struct{}{}, nil 326 } 327 328 func (f *stubFactory) ConstructSaveTable( 329 input exec.Node, table *cat.DataSourceName, colNames []string, 330 ) (exec.Node, error) { 331 return struct{}{}, nil 332 } 333 334 func (f *stubFactory) ConstructErrorIfRows( 335 input exec.Node, mkErr func(tree.Datums) error, 336 ) (exec.Node, error) { 337 return struct{}{}, nil 338 } 339 340 func (f *stubFactory) ConstructOpaque(metadata opt.OpaqueMetadata) (exec.Node, error) { 341 return struct{}{}, nil 342 } 343 344 func (f *stubFactory) ConstructAlterTableSplit( 345 index cat.Index, input exec.Node, expiration tree.TypedExpr, 346 ) (exec.Node, error) { 347 return struct{}{}, nil 348 } 349 350 func (f *stubFactory) ConstructAlterTableUnsplit( 351 index cat.Index, input exec.Node, 352 ) (exec.Node, error) { 353 return struct{}{}, nil 354 } 355 356 func (f *stubFactory) ConstructAlterTableUnsplitAll(index cat.Index) (exec.Node, error) { 357 return struct{}{}, nil 358 } 359 360 func (f *stubFactory) ConstructAlterTableRelocate( 361 index cat.Index, input exec.Node, relocateLease bool, 362 ) (exec.Node, error) { 363 return struct{}{}, nil 364 } 365 366 func (f *stubFactory) ConstructBuffer(value exec.Node, label string) (exec.BufferNode, error) { 367 return struct{ exec.BufferNode }{}, nil 368 } 369 370 func (f *stubFactory) ConstructScanBuffer(ref exec.BufferNode, label string) (exec.Node, error) { 371 return struct{}{}, nil 372 } 373 374 func (f *stubFactory) ConstructRecursiveCTE( 375 initial exec.Node, fn exec.RecursiveCTEIterationFn, label string, 376 ) (exec.Node, error) { 377 return struct{}{}, nil 378 } 379 380 func (f *stubFactory) ConstructControlJobs( 381 command tree.JobCommand, input exec.Node, 382 ) (exec.Node, error) { 383 return struct{}{}, nil 384 } 385 386 func (f *stubFactory) ConstructCancelQueries(input exec.Node, ifExists bool) (exec.Node, error) { 387 return struct{}{}, nil 388 } 389 390 func (f *stubFactory) ConstructCancelSessions(input exec.Node, ifExists bool) (exec.Node, error) { 391 return struct{}{}, nil 392 } 393 394 func (f *stubFactory) ConstructCreateView( 395 schema cat.Schema, 396 viewName string, 397 ifNotExists bool, 398 replace bool, 399 temporary bool, 400 viewQuery string, 401 columns sqlbase.ResultColumns, 402 deps opt.ViewDeps, 403 ) (exec.Node, error) { 404 return struct{}{}, nil 405 } 406 407 func (f *stubFactory) ConstructExport( 408 input exec.Node, fileName tree.TypedExpr, fileFormat string, options []exec.KVOption, 409 ) (exec.Node, error) { 410 return struct{}{}, nil 411 }