diff --git a/Makefile b/Makefile index ddc7c2b208cf..12b1aa99cf62 100644 --- a/Makefile +++ b/Makefile @@ -865,12 +865,12 @@ EXECGEN_TARGETS = \ pkg/sql/colexec/colexecjoin/mergejoiner_rightanti.eg.go \ pkg/sql/colexec/colexecjoin/mergejoiner_rightouter.eg.go \ pkg/sql/colexec/colexecjoin/mergejoiner_rightsemi.eg.go \ - pkg/sql/colexec/colexecproj/default_cmp_proj_const_op.eg.go \ pkg/sql/colexec/colexecproj/default_cmp_proj_op.eg.go \ - pkg/sql/colexec/colexecproj/proj_const_left_ops.eg.go \ - pkg/sql/colexec/colexecproj/proj_const_right_ops.eg.go \ - pkg/sql/colexec/colexecproj/proj_like_ops.eg.go \ pkg/sql/colexec/colexecproj/proj_non_const_ops.eg.go \ + pkg/sql/colexec/colexecprojconst/default_cmp_proj_const_op.eg.go \ + pkg/sql/colexec/colexecprojconst/proj_const_left_ops.eg.go \ + pkg/sql/colexec/colexecprojconst/proj_const_right_ops.eg.go \ + pkg/sql/colexec/colexecprojconst/proj_like_ops.eg.go \ pkg/sql/colexec/colexecsel/default_cmp_sel_ops.eg.go \ pkg/sql/colexec/colexecsel/selection_ops.eg.go \ pkg/sql/colexec/colexecsel/sel_like_ops.eg.go \ diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index f3b3dd24e70c..58e54edda001 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -248,6 +248,8 @@ ALL_TESTS = [ "//pkg/sql/colexec/colexecjoin:colexecjoin_test", "//pkg/sql/colexec/colexecproj:colexecproj_disallowed_imports_test", "//pkg/sql/colexec/colexecproj:colexecproj_test", + "//pkg/sql/colexec/colexecprojconst:colexecprojconst_disallowed_imports_test", + "//pkg/sql/colexec/colexecprojconst:colexecprojconst_test", "//pkg/sql/colexec/colexecsel:colexecsel_disallowed_imports_test", "//pkg/sql/colexec/colexecsel:colexecsel_test", "//pkg/sql/colexec/colexecspan:colexecspan_disallowed_imports_test", diff --git a/pkg/gen/execgen.bzl b/pkg/gen/execgen.bzl index b64d321c6262..de6d55ff3923 100644 --- a/pkg/gen/execgen.bzl +++ b/pkg/gen/execgen.bzl @@ -50,12 +50,12 @@ EXECGEN_SRCS = [ "//pkg/sql/colexec/colexecjoin:mergejoiner_rightanti.eg.go", "//pkg/sql/colexec/colexecjoin:mergejoiner_rightouter.eg.go", "//pkg/sql/colexec/colexecjoin:mergejoiner_rightsemi.eg.go", - "//pkg/sql/colexec/colexecproj:default_cmp_proj_const_op.eg.go", "//pkg/sql/colexec/colexecproj:default_cmp_proj_op.eg.go", - "//pkg/sql/colexec/colexecproj:proj_const_left_ops.eg.go", - "//pkg/sql/colexec/colexecproj:proj_const_right_ops.eg.go", - "//pkg/sql/colexec/colexecproj:proj_like_ops.eg.go", "//pkg/sql/colexec/colexecproj:proj_non_const_ops.eg.go", + "//pkg/sql/colexec/colexecprojconst:default_cmp_proj_const_op.eg.go", + "//pkg/sql/colexec/colexecprojconst:proj_const_left_ops.eg.go", + "//pkg/sql/colexec/colexecprojconst:proj_const_right_ops.eg.go", + "//pkg/sql/colexec/colexecprojconst:proj_like_ops.eg.go", "//pkg/sql/colexec/colexecsel:default_cmp_sel_ops.eg.go", "//pkg/sql/colexec/colexecsel:sel_like_ops.eg.go", "//pkg/sql/colexec/colexecsel:selection_ops.eg.go", diff --git a/pkg/sql/colexec/COLEXEC.bzl b/pkg/sql/colexec/COLEXEC.bzl index c3beb3552142..3a2e74429fda 100644 --- a/pkg/sql/colexec/COLEXEC.bzl +++ b/pkg/sql/colexec/COLEXEC.bzl @@ -13,3 +13,19 @@ $(location :goimports) -w $@ tools = [":execgen", ":goimports"], visibility = [":__pkg__", "//pkg/gen:__pkg__"], ) + +# Generating the code for `default_cmp_proj_const_op.eg.go` requires special +# handling because the template lives in a different package. +def gen_default_cmp_proj_const_rule(name, target, visibility = ["//visibility:private"]): + native.genrule( + name = name, + srcs = ["//pkg/sql/colexec/colexecproj:default_cmp_proj_ops_tmpl.go"], + outs = [target], + cmd = """\ +export COCKROACH_INTERNAL_DISABLE_METAMORPHIC_TESTING=true +$(location :execgen) -template $(SRCS) -fmt=false pkg/sql/colexec/colexecprojconst/$@ > $@ +$(location :goimports) -w $@ +""", + tools = [":execgen", ":goimports"], + visibility = [":__pkg__", "//pkg/gen:__pkg__"], + ) diff --git a/pkg/sql/colexec/colbuilder/BUILD.bazel b/pkg/sql/colexec/colbuilder/BUILD.bazel index 77d7a172e4ba..87e62389062a 100644 --- a/pkg/sql/colexec/colbuilder/BUILD.bazel +++ b/pkg/sql/colexec/colbuilder/BUILD.bazel @@ -17,6 +17,7 @@ go_library( "//pkg/sql/colexec/colexecbase", "//pkg/sql/colexec/colexecjoin", "//pkg/sql/colexec/colexecproj", + "//pkg/sql/colexec/colexecprojconst", "//pkg/sql/colexec/colexecsel", "//pkg/sql/colexec/colexecutils", "//pkg/sql/colexec/colexecwindow", diff --git a/pkg/sql/colexec/colbuilder/execplan.go b/pkg/sql/colexec/colbuilder/execplan.go index 4ecd92664cdc..70b28f2535e6 100644 --- a/pkg/sql/colexec/colbuilder/execplan.go +++ b/pkg/sql/colexec/colbuilder/execplan.go @@ -26,6 +26,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecbase" "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecjoin" "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecproj" + "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecprojconst" "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecsel" "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils" "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecwindow" @@ -2335,7 +2336,7 @@ func planProjectionExpr( resultIdx = len(typs) // The projection result will be outputted to a new column which is // appended to the input batch. - op, err = colexecproj.GetProjectionLConstOperator( + op, err = colexecprojconst.GetProjectionLConstOperator( allocator, typs, left.ResolvedType(), outputType, projOp, input, rightIdx, lConstArg, resultIdx, evalCtx, binFn, cmpExpr, ) @@ -2381,7 +2382,7 @@ func planProjectionExpr( switch cmpProjOp.Symbol { case treecmp.Like, treecmp.NotLike: negate := cmpProjOp.Symbol == treecmp.NotLike - op, err = colexecproj.GetLikeProjectionOperator( + op, err = colexecprojconst.GetLikeProjectionOperator( allocator, evalCtx, input, leftIdx, resultIdx, string(tree.MustBeDString(rConstArg)), negate, ) @@ -2412,7 +2413,7 @@ func planProjectionExpr( if op == nil || err != nil { // op hasn't been created yet, so let's try the constructor for // all other projection operators. - op, err = colexecproj.GetProjectionRConstOperator( + op, err = colexecprojconst.GetProjectionRConstOperator( allocator, typs, right.ResolvedType(), outputType, projOp, input, leftIdx, rConstArg, resultIdx, evalCtx, binFn, cmpExpr, ) diff --git a/pkg/sql/colexec/colexecagg/BUILD.bazel b/pkg/sql/colexec/colexecagg/BUILD.bazel index 10ee2571d2e4..25003bfb6939 100644 --- a/pkg/sql/colexec/colexecagg/BUILD.bazel +++ b/pkg/sql/colexec/colexecagg/BUILD.bazel @@ -79,6 +79,7 @@ disallowed_imports_test( "//pkg/sql/colexec/colexechash", "//pkg/sql/colexec/colexecjoin", "//pkg/sql/colexec/colexecproj", + "//pkg/sql/colexec/colexecprojconst", "//pkg/sql/colexec/colexecsel", "//pkg/sql/colexec/colexecwindow", ], diff --git a/pkg/sql/colexec/colexecbase/BUILD.bazel b/pkg/sql/colexec/colexecbase/BUILD.bazel index 1139b32b27ec..bfeb76cd52b4 100644 --- a/pkg/sql/colexec/colexecbase/BUILD.bazel +++ b/pkg/sql/colexec/colexecbase/BUILD.bazel @@ -109,6 +109,7 @@ disallowed_imports_test( "//pkg/sql/colexec/colexechash", "//pkg/sql/colexec/colexecjoin", "//pkg/sql/colexec/colexecproj", + "//pkg/sql/colexec/colexecprojconst", "//pkg/sql/colexec/colexecsel", "//pkg/sql/colexec/colexecwindow", ], diff --git a/pkg/sql/colexec/colexechash/BUILD.bazel b/pkg/sql/colexec/colexechash/BUILD.bazel index 32702cb6ea4c..e8d8763e6770 100644 --- a/pkg/sql/colexec/colexechash/BUILD.bazel +++ b/pkg/sql/colexec/colexechash/BUILD.bazel @@ -80,6 +80,7 @@ disallowed_imports_test( "//pkg/sql/colexec/colexecbase", "//pkg/sql/colexec/colexecjoin", "//pkg/sql/colexec/colexecproj", + "//pkg/sql/colexec/colexecprojconst", "//pkg/sql/colexec/colexecsel", "//pkg/sql/colexec/colexecwindow", ], diff --git a/pkg/sql/colexec/colexecjoin/BUILD.bazel b/pkg/sql/colexec/colexecjoin/BUILD.bazel index 1641e6073b1a..7423cf60c15a 100644 --- a/pkg/sql/colexec/colexecjoin/BUILD.bazel +++ b/pkg/sql/colexec/colexecjoin/BUILD.bazel @@ -105,6 +105,7 @@ disallowed_imports_test( "//pkg/sql/colexec", "//pkg/sql/colexec/colexecagg", "//pkg/sql/colexec/colexecproj", + "//pkg/sql/colexec/colexecprojconst", "//pkg/sql/colexec/colexecsel", "//pkg/sql/colexec/colexecwindow", ], diff --git a/pkg/sql/colexec/colexecproj/BUILD.bazel b/pkg/sql/colexec/colexecproj/BUILD.bazel index 1b78ccb98b0a..0123603888a1 100644 --- a/pkg/sql/colexec/colexecproj/BUILD.bazel +++ b/pkg/sql/colexec/colexecproj/BUILD.bazel @@ -5,10 +5,9 @@ load("//pkg/testutils/buildutil:buildutil.bzl", "disallowed_imports_test") go_library( name = "colexecproj", srcs = [ - "like_ops.go", ":gen-exec", # keep ], - importpath = "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecproj", + importpath = "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecproj", # keep visibility = ["//visibility:public"], deps = [ "//pkg/col/coldata", # keep @@ -17,22 +16,22 @@ go_library( "//pkg/server/telemetry", # keep "//pkg/sql/colconv", # keep "//pkg/sql/colexec/colexecbase", # keep - "//pkg/sql/colexec/colexeccmp", - "//pkg/sql/colexec/colexecutils", + "//pkg/sql/colexec/colexeccmp", # keep + "//pkg/sql/colexec/colexecutils", # keep "//pkg/sql/colexec/execgen", # keep "//pkg/sql/colexecerror", # keep - "//pkg/sql/colexecop", - "//pkg/sql/colmem", + "//pkg/sql/colexecop", # keep + "//pkg/sql/colmem", # keep "//pkg/sql/execinfra", # keep - "//pkg/sql/sem/tree", + "//pkg/sql/sem/tree", # keep "//pkg/sql/sem/tree/treebin", # keep "//pkg/sql/sem/tree/treecmp", # keep "//pkg/sql/sqltelemetry", # keep - "//pkg/sql/types", + "//pkg/sql/types", # keep "//pkg/util/duration", # keep "//pkg/util/json", # keep "@com_github_cockroachdb_apd_v3//:apd", # keep - "@com_github_cockroachdb_errors//:errors", + "@com_github_cockroachdb_errors//:errors", # keep ], ) @@ -44,7 +43,7 @@ go_test( "main_test.go", "projection_ops_test.go", ], - embed = [":colexecproj"], + embed = [":colexecproj"], # keep tags = ["no-remote"], deps = [ "//pkg/col/coldata", @@ -74,13 +73,13 @@ go_test( ], ) +# Export the template because it is used by another target in colexecprojconst +# package. +exports_files(["default_cmp_proj_ops_tmpl.go"]) + # Map between target name and relevant template. targets = [ - ("default_cmp_proj_const_op.eg.go", "default_cmp_proj_ops_tmpl.go"), ("default_cmp_proj_op.eg.go", "default_cmp_proj_ops_tmpl.go"), - ("proj_const_left_ops.eg.go", "proj_const_ops_tmpl.go"), - ("proj_const_right_ops.eg.go", "proj_const_ops_tmpl.go"), - ("proj_like_ops.eg.go", "proj_const_ops_tmpl.go"), ("proj_non_const_ops.eg.go", "proj_non_const_ops_tmpl.go"), ] @@ -100,6 +99,7 @@ disallowed_imports_test( "//pkg/sql/colexec/colexecagg", "//pkg/sql/colexec/colexechash", "//pkg/sql/colexec/colexecjoin", + "//pkg/sql/colexec/colexecprojconst", "//pkg/sql/colexec/colexecsel", "//pkg/sql/colexec/colexecwindow", ], diff --git a/pkg/sql/colexec/colexecproj/proj_non_const_ops.eg.go b/pkg/sql/colexec/colexecproj/proj_non_const_ops.eg.go index 6eb9dfcff23f..86f8c4fd7837 100644 --- a/pkg/sql/colexec/colexecproj/proj_non_const_ops.eg.go +++ b/pkg/sql/colexec/colexecproj/proj_non_const_ops.eg.go @@ -46,18 +46,6 @@ var ( _ apd.Context ) -// projConstOpBase contains all of the fields for projections with a constant, -// except for the constant itself. -// NOTE: this struct should be declared in proj_const_ops_tmpl.go, but if we do -// so, it'll be redeclared because we execute that template twice. To go -// around the problem we specify it here. -type projConstOpBase struct { - colexecop.OneInputHelper - allocator *colmem.Allocator - colIdx int - outputIdx int -} - // projOpBase contains all of the fields for non-constant projections. type projOpBase struct { colexecop.OneInputHelper diff --git a/pkg/sql/colexec/colexecproj/proj_non_const_ops_tmpl.go b/pkg/sql/colexec/colexecproj/proj_non_const_ops_tmpl.go index ca8cef7ea17e..008b6afef1c2 100644 --- a/pkg/sql/colexec/colexecproj/proj_non_const_ops_tmpl.go +++ b/pkg/sql/colexec/colexecproj/proj_non_const_ops_tmpl.go @@ -76,18 +76,6 @@ func _ASSIGN(_, _, _, _, _, _ interface{}) { // */}} -// projConstOpBase contains all of the fields for projections with a constant, -// except for the constant itself. -// NOTE: this struct should be declared in proj_const_ops_tmpl.go, but if we do -// so, it'll be redeclared because we execute that template twice. To go -// around the problem we specify it here. -type projConstOpBase struct { - colexecop.OneInputHelper - allocator *colmem.Allocator - colIdx int - outputIdx int -} - // projOpBase contains all of the fields for non-constant projections. type projOpBase struct { colexecop.OneInputHelper diff --git a/pkg/sql/colexec/colexecproj/projection_ops_test.go b/pkg/sql/colexec/colexecproj/projection_ops_test.go index 8bab832e2dc4..ef1d90715e3f 100644 --- a/pkg/sql/colexec/colexecproj/projection_ops_test.go +++ b/pkg/sql/colexec/colexecproj/projection_ops_test.go @@ -102,70 +102,6 @@ func TestProjDivFloat64Float64Op(t *testing.T) { }) } -func TestGetProjectionConstOperator(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - binOp := treebin.MakeBinaryOperator(treebin.Mult) - var input colexecop.Operator - colIdx := 3 - inputTypes := make([]*types.T, colIdx+1) - inputTypes[colIdx] = types.Float - constVal := 31.37 - constArg := tree.NewDFloat(tree.DFloat(constVal)) - outputIdx := 5 - op, err := GetProjectionRConstOperator( - testAllocator, inputTypes, types.Float, types.Float, binOp, input, colIdx, - constArg, outputIdx, nil /* EvalCtx */, nil /* BinFn */, nil, /* cmpExpr */ - ) - if err != nil { - t.Error(err) - } - expected := &projMultFloat64Float64ConstOp{ - projConstOpBase: projConstOpBase{ - OneInputHelper: colexecop.MakeOneInputHelper(op.(*projMultFloat64Float64ConstOp).Input), - allocator: testAllocator, - colIdx: colIdx, - outputIdx: outputIdx, - }, - constArg: constVal, - } - if !reflect.DeepEqual(op, expected) { - t.Errorf("got %+v,\nexpected %+v", op, expected) - } -} - -func TestGetProjectionConstMixedTypeOperator(t *testing.T) { - defer leaktest.AfterTest(t)() - defer log.Scope(t).Close(t) - cmpOp := treecmp.MakeComparisonOperator(treecmp.GE) - var input colexecop.Operator - colIdx := 3 - inputTypes := make([]*types.T, colIdx+1) - inputTypes[colIdx] = types.Int - constVal := int16(31) - constArg := tree.NewDInt(tree.DInt(constVal)) - outputIdx := 5 - op, err := GetProjectionRConstOperator( - testAllocator, inputTypes, types.Int2, types.Int, cmpOp, input, colIdx, - constArg, outputIdx, nil /* EvalCtx */, nil /* BinFn */, nil, /* cmpExpr */ - ) - if err != nil { - t.Error(err) - } - expected := &projGEInt64Int16ConstOp{ - projConstOpBase: projConstOpBase{ - OneInputHelper: colexecop.MakeOneInputHelper(op.(*projGEInt64Int16ConstOp).Input), - allocator: testAllocator, - colIdx: colIdx, - outputIdx: outputIdx, - }, - constArg: constVal, - } - if !reflect.DeepEqual(op, expected) { - t.Errorf("got %+v,\nexpected %+v", op, expected) - } -} - // TestRandomComparisons runs comparisons against all scalar types with random // non-null data verifying that the result of Datum.Compare matches the result // of the exec projection. diff --git a/pkg/sql/colexec/colexecprojconst/BUILD.bazel b/pkg/sql/colexec/colexecprojconst/BUILD.bazel new file mode 100644 index 000000000000..fec818e7ff00 --- /dev/null +++ b/pkg/sql/colexec/colexecprojconst/BUILD.bazel @@ -0,0 +1,90 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") +load("//pkg/sql/colexecop:EXECGEN.bzl", "eg_go_filegroup", "gen_eg_go_rules") +load("//pkg/sql/colexec:COLEXEC.bzl", "gen_default_cmp_proj_const_rule") +load("//pkg/testutils/buildutil:buildutil.bzl", "disallowed_imports_test") + +go_library( + name = "colexecprojconst", + srcs = [ + "like_ops.go", + "proj_const_ops_base.go", + ":gen-default-cmp-proj-const-op", # keep + ":gen-exec", # keep + ], + importpath = "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecprojconst", + visibility = ["//visibility:public"], + deps = [ + "//pkg/col/coldata", # keep + "//pkg/col/coldataext", # keep + "//pkg/col/typeconv", # keep + "//pkg/server/telemetry", # keep + "//pkg/sql/colconv", # keep + "//pkg/sql/colexec/colexecbase", # keep + "//pkg/sql/colexec/colexeccmp", + "//pkg/sql/colexec/colexecutils", + "//pkg/sql/colexec/execgen", # keep + "//pkg/sql/colexecerror", # keep + "//pkg/sql/colexecop", + "//pkg/sql/colmem", + "//pkg/sql/execinfra", # keep + "//pkg/sql/sem/tree", + "//pkg/sql/sem/tree/treebin", # keep + "//pkg/sql/sem/tree/treecmp", # keep + "//pkg/sql/sqltelemetry", # keep + "//pkg/sql/types", + "//pkg/util/duration", # keep + "//pkg/util/json", # keep + "@com_github_cockroachdb_apd_v3//:apd", # keep + "@com_github_cockroachdb_errors//:errors", + ], +) + +go_test( + name = "colexecprojconst_test", + srcs = ["projection_ops_test.go"], + embed = [":colexecprojconst"], + deps = [ + "//pkg/sql/colexecop", + "//pkg/sql/sem/tree", + "//pkg/sql/sem/tree/treebin", + "//pkg/sql/sem/tree/treecmp", + "//pkg/sql/types", + "//pkg/util/leaktest", + "//pkg/util/log", + ], +) + +# Map between target name and relevant template. +targets = [ + ("proj_const_left_ops.eg.go", "proj_const_ops_tmpl.go"), + ("proj_const_right_ops.eg.go", "proj_const_ops_tmpl.go"), + ("proj_like_ops.eg.go", "proj_const_ops_tmpl.go"), +] + +# Define a file group for all the .eg.go targets. +eg_go_filegroup( + name = "gen-exec", + targets = targets, +) + +# Define gen rules for individual eg.go files. +gen_eg_go_rules(targets) + +# Special-case the gen rule for default_cmp_proj_const_op.eg.go. +gen_default_cmp_proj_const_rule( + name = "gen-default-cmp-proj-const-op", + target = "default_cmp_proj_const_op.eg.go", +) + +disallowed_imports_test( + "colexecprojconst", + [ + "//pkg/sql/colexec", + "//pkg/sql/colexec/colexecagg", + "//pkg/sql/colexec/colexechash", + "//pkg/sql/colexec/colexecjoin", + "//pkg/sql/colexec/colexecproj", + "//pkg/sql/colexec/colexecsel", + "//pkg/sql/colexec/colexecwindow", + ], +) diff --git a/pkg/sql/colexec/colexecproj/default_cmp_proj_const_op.eg.go b/pkg/sql/colexec/colexecprojconst/default_cmp_proj_const_op.eg.go similarity index 98% rename from pkg/sql/colexec/colexecproj/default_cmp_proj_const_op.eg.go rename to pkg/sql/colexec/colexecprojconst/default_cmp_proj_const_op.eg.go index 2e940db20cf1..9bd3adfa90bb 100644 --- a/pkg/sql/colexec/colexecproj/default_cmp_proj_const_op.eg.go +++ b/pkg/sql/colexec/colexecprojconst/default_cmp_proj_const_op.eg.go @@ -8,7 +8,7 @@ // by the Apache License, Version 2.0, included in the file // licenses/APL.txt. -package colexecproj +package colexecprojconst import ( "github.com/cockroachdb/cockroach/pkg/col/coldata" diff --git a/pkg/sql/colexec/colexecproj/like_ops.go b/pkg/sql/colexec/colexecprojconst/like_ops.go similarity index 99% rename from pkg/sql/colexec/colexecproj/like_ops.go rename to pkg/sql/colexec/colexecprojconst/like_ops.go index 398b323140bb..962d16cb9c3e 100644 --- a/pkg/sql/colexec/colexecproj/like_ops.go +++ b/pkg/sql/colexec/colexecprojconst/like_ops.go @@ -8,7 +8,7 @@ // by the Apache License, Version 2.0, included in the file // licenses/APL.txt. -package colexecproj +package colexecprojconst import ( "github.com/cockroachdb/cockroach/pkg/sql/colexec/colexeccmp" diff --git a/pkg/sql/colexec/colexecproj/proj_const_left_ops.eg.go b/pkg/sql/colexec/colexecprojconst/proj_const_left_ops.eg.go similarity index 99% rename from pkg/sql/colexec/colexecproj/proj_const_left_ops.eg.go rename to pkg/sql/colexec/colexecprojconst/proj_const_left_ops.eg.go index d2e8cc71c40f..2a0d62bd0d08 100644 --- a/pkg/sql/colexec/colexecproj/proj_const_left_ops.eg.go +++ b/pkg/sql/colexec/colexecprojconst/proj_const_left_ops.eg.go @@ -7,7 +7,7 @@ // by the Apache License, Version 2.0, included in the file // licenses/APL.txt. -package colexecproj +package colexecprojconst import ( "math" diff --git a/pkg/sql/colexec/colexecprojconst/proj_const_ops_base.go b/pkg/sql/colexec/colexecprojconst/proj_const_ops_base.go new file mode 100644 index 000000000000..429eccde3ce3 --- /dev/null +++ b/pkg/sql/colexec/colexecprojconst/proj_const_ops_base.go @@ -0,0 +1,25 @@ +// Copyright 2022 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package colexecprojconst + +import ( + "github.com/cockroachdb/cockroach/pkg/sql/colexecop" + "github.com/cockroachdb/cockroach/pkg/sql/colmem" +) + +// projConstOpBase contains all of the fields for projections with a constant, +// except for the constant itself. +type projConstOpBase struct { + colexecop.OneInputHelper + allocator *colmem.Allocator + colIdx int + outputIdx int +} diff --git a/pkg/sql/colexec/colexecproj/proj_const_ops_tmpl.go b/pkg/sql/colexec/colexecprojconst/proj_const_ops_tmpl.go similarity index 99% rename from pkg/sql/colexec/colexecproj/proj_const_ops_tmpl.go rename to pkg/sql/colexec/colexecprojconst/proj_const_ops_tmpl.go index 8719cdf04087..fe878c65bd98 100644 --- a/pkg/sql/colexec/colexecproj/proj_const_ops_tmpl.go +++ b/pkg/sql/colexec/colexecprojconst/proj_const_ops_tmpl.go @@ -19,7 +19,7 @@ // // */}} -package colexecproj +package colexecprojconst import ( "github.com/cockroachdb/apd/v3" diff --git a/pkg/sql/colexec/colexecproj/proj_const_right_ops.eg.go b/pkg/sql/colexec/colexecprojconst/proj_const_right_ops.eg.go similarity index 99% rename from pkg/sql/colexec/colexecproj/proj_const_right_ops.eg.go rename to pkg/sql/colexec/colexecprojconst/proj_const_right_ops.eg.go index d4d1470bd6be..64c61155d775 100644 --- a/pkg/sql/colexec/colexecproj/proj_const_right_ops.eg.go +++ b/pkg/sql/colexec/colexecprojconst/proj_const_right_ops.eg.go @@ -7,7 +7,7 @@ // by the Apache License, Version 2.0, included in the file // licenses/APL.txt. -package colexecproj +package colexecprojconst import ( "bytes" diff --git a/pkg/sql/colexec/colexecproj/proj_like_ops.eg.go b/pkg/sql/colexec/colexecprojconst/proj_like_ops.eg.go similarity index 99% rename from pkg/sql/colexec/colexecproj/proj_like_ops.eg.go rename to pkg/sql/colexec/colexecprojconst/proj_like_ops.eg.go index ea54a054f456..5e8df3c9a798 100644 --- a/pkg/sql/colexec/colexecproj/proj_like_ops.eg.go +++ b/pkg/sql/colexec/colexecprojconst/proj_like_ops.eg.go @@ -8,7 +8,7 @@ // by the Apache License, Version 2.0, included in the file // licenses/APL.txt. -package colexecproj +package colexecprojconst import ( "bytes" diff --git a/pkg/sql/colexec/colexecprojconst/projection_ops_test.go b/pkg/sql/colexec/colexecprojconst/projection_ops_test.go new file mode 100644 index 000000000000..28893b19b51a --- /dev/null +++ b/pkg/sql/colexec/colexecprojconst/projection_ops_test.go @@ -0,0 +1,86 @@ +// Copyright 2022 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package colexecprojconst + +import ( + "reflect" + "testing" + + "github.com/cockroachdb/cockroach/pkg/sql/colexecop" + "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" + "github.com/cockroachdb/cockroach/pkg/sql/sem/tree/treebin" + "github.com/cockroachdb/cockroach/pkg/sql/sem/tree/treecmp" + "github.com/cockroachdb/cockroach/pkg/sql/types" + "github.com/cockroachdb/cockroach/pkg/util/leaktest" + "github.com/cockroachdb/cockroach/pkg/util/log" +) + +func TestGetProjectionConstOperator(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + binOp := treebin.MakeBinaryOperator(treebin.Mult) + var input colexecop.Operator + colIdx := 3 + inputTypes := make([]*types.T, colIdx+1) + inputTypes[colIdx] = types.Float + constVal := 31.37 + constArg := tree.NewDFloat(tree.DFloat(constVal)) + outputIdx := 5 + op, err := GetProjectionRConstOperator( + nil /* allocator */, inputTypes, types.Float, types.Float, binOp, input, colIdx, + constArg, outputIdx, nil /* EvalCtx */, nil /* BinFn */, nil, /* cmpExpr */ + ) + if err != nil { + t.Error(err) + } + expected := &projMultFloat64Float64ConstOp{ + projConstOpBase: projConstOpBase{ + OneInputHelper: colexecop.MakeOneInputHelper(op.(*projMultFloat64Float64ConstOp).Input), + colIdx: colIdx, + outputIdx: outputIdx, + }, + constArg: constVal, + } + if !reflect.DeepEqual(op, expected) { + t.Errorf("got %+v,\nexpected %+v", op, expected) + } +} + +func TestGetProjectionConstMixedTypeOperator(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + cmpOp := treecmp.MakeComparisonOperator(treecmp.GE) + var input colexecop.Operator + colIdx := 3 + inputTypes := make([]*types.T, colIdx+1) + inputTypes[colIdx] = types.Int + constVal := int16(31) + constArg := tree.NewDInt(tree.DInt(constVal)) + outputIdx := 5 + op, err := GetProjectionRConstOperator( + nil /* allocator */, inputTypes, types.Int2, types.Int, cmpOp, input, colIdx, + constArg, outputIdx, nil /* EvalCtx */, nil /* BinFn */, nil, /* cmpExpr */ + ) + if err != nil { + t.Error(err) + } + expected := &projGEInt64Int16ConstOp{ + projConstOpBase: projConstOpBase{ + OneInputHelper: colexecop.MakeOneInputHelper(op.(*projGEInt64Int16ConstOp).Input), + colIdx: colIdx, + outputIdx: outputIdx, + }, + constArg: constVal, + } + if !reflect.DeepEqual(op, expected) { + t.Errorf("got %+v,\nexpected %+v", op, expected) + } +} diff --git a/pkg/sql/colexec/colexecsel/BUILD.bazel b/pkg/sql/colexec/colexecsel/BUILD.bazel index e5fdc3d904b9..04d6fadc7947 100644 --- a/pkg/sql/colexec/colexecsel/BUILD.bazel +++ b/pkg/sql/colexec/colexecsel/BUILD.bazel @@ -86,6 +86,7 @@ disallowed_imports_test( "//pkg/sql/colexec/colexechash", "//pkg/sql/colexec/colexecjoin", "//pkg/sql/colexec/colexecproj", + "//pkg/sql/colexec/colexecprojconst", "//pkg/sql/colexec/colexecwindow", ], ) diff --git a/pkg/sql/colexec/colexecspan/BUILD.bazel b/pkg/sql/colexec/colexecspan/BUILD.bazel index c54a22734f4c..90e83f79a04a 100644 --- a/pkg/sql/colexec/colexecspan/BUILD.bazel +++ b/pkg/sql/colexec/colexecspan/BUILD.bazel @@ -94,6 +94,7 @@ disallowed_imports_test( "//pkg/sql/colexec/colexechash", "//pkg/sql/colexec/colexecjoin", "//pkg/sql/colexec/colexecproj", + "//pkg/sql/colexec/colexecprojconst", "//pkg/sql/colexec/colexecsel", "//pkg/sql/colexec/colexecwindow", ], diff --git a/pkg/sql/colexec/colexecwindow/BUILD.bazel b/pkg/sql/colexec/colexecwindow/BUILD.bazel index 8ce456a0ac65..1bc0aebe9786 100644 --- a/pkg/sql/colexec/colexecwindow/BUILD.bazel +++ b/pkg/sql/colexec/colexecwindow/BUILD.bazel @@ -123,6 +123,7 @@ disallowed_imports_test( "//pkg/sql/colexec/colexechash", "//pkg/sql/colexec/colexecjoin", "//pkg/sql/colexec/colexecproj", + "//pkg/sql/colexec/colexecprojconst", "//pkg/sql/colexec/colexecsel", ], ) diff --git a/pkg/sql/colexec/execgen/cmd/execgen/default_cmp_proj_ops_gen.go b/pkg/sql/colexec/execgen/cmd/execgen/default_cmp_proj_ops_gen.go index 68e780d6f177..f938869134be 100644 --- a/pkg/sql/colexec/execgen/cmd/execgen/default_cmp_proj_ops_gen.go +++ b/pkg/sql/colexec/execgen/cmd/execgen/default_cmp_proj_ops_gen.go @@ -77,7 +77,7 @@ func init() { registerGenerator( getDefaultCmpProjOps( defaultCmpProjOpOverload{ - TargetPkg: "colexecproj", + TargetPkg: "colexecprojconst", IsRightConst: true, Kind: "RConst", }), diff --git a/pkg/sql/colexec/execgen/cmd/execgen/like_ops_gen.go b/pkg/sql/colexec/execgen/cmd/execgen/like_ops_gen.go index 9c39001b88c2..ffe2a5e0fa50 100644 --- a/pkg/sql/colexec/execgen/cmd/execgen/like_ops_gen.go +++ b/pkg/sql/colexec/execgen/cmd/execgen/like_ops_gen.go @@ -24,8 +24,10 @@ import ( // are several different implementations which may be chosen depending on the // complexity of the LIKE pattern. // -// likeTemplate needs to be used as a format string expecting exactly one %s -// arguments that describes the type of the operator (either "sel" or "proj"). +// likeTemplate needs to be used as a format string expecting exactly two %s +// arguments: +// [1]: is the package suffix (either "sel" or "projconst") +// [2]: is the type of the operator (either "sel" or "proj"). const likeTemplate = ` // Copyright 2019 The Cockroach Authors. // @@ -48,12 +50,15 @@ import ( ) {{range .}} -{{template "%[1]sConstOp" .}} +{{template "%[2]sConstOp" .}} {{end}} ` func genLikeOps( tmplGetter func(inputFileContents string) (*template.Template, error), + // pkgSuffix is the suffix of the package for the operator to be generated + // in (either "sel" or "projconst"). + pkgSuffix string, // opType is the type of the operator to be generated (either "sel" or // "proj"). opType string, @@ -63,7 +68,7 @@ func genLikeOps( if err != nil { return err } - tmpl, err = tmpl.Parse(fmt.Sprintf(likeTemplate, opType)) + tmpl, err = tmpl.Parse(fmt.Sprintf(likeTemplate, pkgSuffix, opType)) if err != nil { return err } @@ -147,6 +152,6 @@ func init() { projTemplate := replaceProjConstTmplVariables(inputFileContents, false /* isConstLeft */) return template.New("proj_like_ops").Funcs(template.FuncMap{"buildDict": buildDict}).Parse(projTemplate) } - registerGenerator(genLikeOps(getProjectionOpsTmpl, "proj"), "proj_like_ops.eg.go", projConstOpsTmpl) - registerGenerator(genLikeOps(getSelectionOpsTmpl, "sel"), "sel_like_ops.eg.go", selectionOpsTmpl) + registerGenerator(genLikeOps(getProjectionOpsTmpl, "projconst", "proj"), "proj_like_ops.eg.go", projConstOpsTmpl) + registerGenerator(genLikeOps(getSelectionOpsTmpl, "sel", "sel"), "sel_like_ops.eg.go", selectionOpsTmpl) } diff --git a/pkg/sql/colexec/execgen/cmd/execgen/projection_ops_gen.go b/pkg/sql/colexec/execgen/cmd/execgen/projection_ops_gen.go index 6d4ef99aaf27..d9cbc4747717 100644 --- a/pkg/sql/colexec/execgen/cmd/execgen/projection_ops_gen.go +++ b/pkg/sql/colexec/execgen/cmd/execgen/projection_ops_gen.go @@ -16,7 +16,7 @@ import ( "text/template" ) -const projConstOpsTmpl = "pkg/sql/colexec/colexecproj/proj_const_ops_tmpl.go" +const projConstOpsTmpl = "pkg/sql/colexec/colexecprojconst/proj_const_ops_tmpl.go" // replaceProjTmplVariables replaces template variables used in the templates // for projection operators. It should only be used within this file. diff --git a/pkg/sql/opt/exec/execbuilder/testdata/tpch_vec b/pkg/sql/opt/exec/execbuilder/testdata/tpch_vec index ea49ace203ec..e921ea5295c4 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/tpch_vec +++ b/pkg/sql/opt/exec/execbuilder/testdata/tpch_vec @@ -20536,11 +20536,11 @@ EXPLAIN (VEC) SELECT l_returnflag, l_linestatus, sum(l_quantity) AS sum_qty, sum └ *colexec.sortOp └ *colexec.hashAggregator └ *colexecproj.projMultFloat64Float64Op - └ *colexecproj.projPlusFloat64Float64ConstOp + └ *colexecprojconst.projPlusFloat64Float64ConstOp └ *colexecproj.projMultFloat64Float64Op - └ *colexecproj.projMinusFloat64ConstFloat64Op + └ *colexecprojconst.projMinusFloat64ConstFloat64Op └ *colexecproj.projMultFloat64Float64Op - └ *colexecproj.projMinusFloat64ConstFloat64Op + └ *colexecprojconst.projMinusFloat64ConstFloat64Op └ *colexecsel.selLEInt64Int64ConstOp └ *colfetcher.ColBatchScan @@ -20607,7 +20607,7 @@ EXPLAIN (VEC) SELECT n_name, sum(l_extendedprice * (1 - l_discount)) AS revenue └ *colexec.sortOp └ *colexec.hashAggregator └ *colexecproj.projMultFloat64Float64Op - └ *colexecproj.projMinusFloat64ConstFloat64Op + └ *colexecprojconst.projMinusFloat64ConstFloat64Op └ *colexecjoin.hashJoiner ├ *rowexec.joinReader │ └ *colexecjoin.hashJoiner @@ -20643,7 +20643,7 @@ EXPLAIN (VEC) SELECT supp_nation, cust_nation, l_year, sum(volume) AS revenue FR └ *colexec.sortOp └ *colexec.hashAggregator └ *colexecproj.projMultFloat64Float64Op - └ *colexecproj.projMinusFloat64ConstFloat64Op + └ *colexecprojconst.projMinusFloat64ConstFloat64Op └ *colexec.defaultBuiltinFuncOperator └ *colexecbase.constBytesOp └ *colexecjoin.hashJoiner @@ -20660,13 +20660,13 @@ EXPLAIN (VEC) SELECT supp_nation, cust_nation, l_year, sum(volume) AS revenue FR ├ *colexecbase.constBoolOp │ └ *colexec.andProjOp │ ├ *colexec.bufferOp - │ ├ *colexecproj.projEQBytesBytesConstOp - │ └ *colexecproj.projEQBytesBytesConstOp + │ ├ *colexecprojconst.projEQBytesBytesConstOp + │ └ *colexecprojconst.projEQBytesBytesConstOp ├ *colexecbase.constBoolOp │ └ *colexec.andProjOp │ ├ *colexec.bufferOp - │ ├ *colexecproj.projEQBytesBytesConstOp - │ └ *colexecproj.projEQBytesBytesConstOp + │ ├ *colexecprojconst.projEQBytesBytesConstOp + │ └ *colexecprojconst.projEQBytesBytesConstOp └ *colexecbase.constBoolOp └ *colexec.bufferOp @@ -20682,7 +20682,7 @@ EXPLAIN (VEC) SELECT o_year, sum(CASE WHEN nation = 'BRAZIL' THEN volume ELSE 0 └ *colexec.caseOp ├ *colexec.bufferOp │ └ *colexecproj.projMultFloat64Float64Op - │ └ *colexecproj.projMinusFloat64ConstFloat64Op + │ └ *colexecprojconst.projMinusFloat64ConstFloat64Op │ └ *colexec.defaultBuiltinFuncOperator │ └ *colexecbase.constBytesOp │ └ *colexecjoin.hashJoiner @@ -20699,7 +20699,7 @@ EXPLAIN (VEC) SELECT o_year, sum(CASE WHEN nation = 'BRAZIL' THEN volume ELSE 0 │ │ └ *colexecsel.selEQBytesBytesConstOp │ │ └ *colfetcher.ColBatchScan │ └ *colfetcher.ColBatchScan - ├ *colexecproj.projEQBytesBytesConstOp + ├ *colexecprojconst.projEQBytesBytesConstOp │ └ *colexec.bufferOp └ *colexecbase.constFloat64Op └ *colexec.bufferOp @@ -20715,7 +20715,7 @@ EXPLAIN (VEC) SELECT nation, o_year, sum(amount) AS sum_profit FROM ( SELECT n_n └ *colexecproj.projMinusFloat64Float64Op └ *colexecproj.projMultFloat64Float64Op └ *colexecproj.projMultFloat64Float64Op - └ *colexecproj.projMinusFloat64ConstFloat64Op + └ *colexecprojconst.projMinusFloat64ConstFloat64Op └ *colexec.defaultBuiltinFuncOperator └ *colexecbase.constBytesOp └ *colexecjoin.hashJoiner @@ -20739,7 +20739,7 @@ EXPLAIN (VEC) SELECT c_custkey, c_name, sum(l_extendedprice * (1 - l_discount)) └ *colexec.topKSorter └ *colexec.hashAggregator └ *colexecproj.projMultFloat64Float64Op - └ *colexecproj.projMinusFloat64ConstFloat64Op + └ *colexecprojconst.projMinusFloat64ConstFloat64Op └ *colexecjoin.hashJoiner ├ *colexecjoin.hashJoiner │ ├ *colfetcher.ColBatchScan @@ -20801,10 +20801,10 @@ EXPLAIN (VEC) SELECT 100.00 * sum(CASE WHEN p_type LIKE 'PROMO%' THEN l_extended │ └ Node 1 └ *colexecproj.projDivFloat64Float64Op - └ *colexecproj.projMultFloat64Float64ConstOp + └ *colexecprojconst.projMultFloat64Float64ConstOp └ *colexec.orderedAggregator └ *colexecproj.projMultFloat64Float64Op - └ *colexecproj.projMinusFloat64ConstFloat64Op + └ *colexecprojconst.projMinusFloat64ConstFloat64Op └ *colexec.caseOp ├ *colexec.bufferOp │ └ *colexecjoin.hashJoiner @@ -20812,8 +20812,8 @@ EXPLAIN (VEC) SELECT 100.00 * sum(CASE WHEN p_type LIKE 'PROMO%' THEN l_extended │ └ *colfetcher.ColIndexJoin │ └ *colfetcher.ColBatchScan ├ *colexecproj.projMultFloat64Float64Op - │ └ *colexecproj.projMinusFloat64ConstFloat64Op - │ └ *colexecproj.projPrefixBytesBytesConstOp + │ └ *colexecprojconst.projMinusFloat64ConstFloat64Op + │ └ *colexecprojconst.projPrefixBytesBytesConstOp │ └ *colexec.bufferOp └ *colexecbase.constFloat64Op └ *colexec.bufferOp @@ -20835,7 +20835,7 @@ EXPLAIN (VEC) SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM s └ *colexecbase.constNullOp └ *colexec.hashAggregator └ *colexecproj.projMultFloat64Float64Op - └ *colexecproj.projMinusFloat64ConstFloat64Op + └ *colexecprojconst.projMinusFloat64ConstFloat64Op └ *colfetcher.ColIndexJoin └ *colfetcher.ColBatchScan @@ -20866,11 +20866,11 @@ EXPLAIN (VEC) SELECT sum(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem, par ---- │ └ Node 1 - └ *colexecproj.projDivFloat64Float64ConstOp + └ *colexecprojconst.projDivFloat64Float64ConstOp └ *colexec.orderedAggregator └ *rowexec.joinReader └ *rowexec.joinReader - └ *colexecproj.projMultFloat64Float64ConstOp + └ *colexecprojconst.projMultFloat64Float64ConstOp └ *colexec.orderedAggregator └ *rowexec.joinReader └ *rowexec.joinReader @@ -20904,7 +20904,7 @@ EXPLAIN (VEC) SELECT sum(l_extendedprice* (1 - l_discount)) AS revenue FROM line └ Node 1 └ *colexec.orderedAggregator └ *colexecproj.projMultFloat64Float64Op - └ *colexecproj.projMinusFloat64ConstFloat64Op + └ *colexecprojconst.projMinusFloat64ConstFloat64Op └ *colexec.caseOp ├ *colexec.bufferOp │ └ *colexecjoin.hashJoiner @@ -20920,31 +20920,31 @@ EXPLAIN (VEC) SELECT sum(l_extendedprice* (1 - l_discount)) AS revenue FROM line │ │ ├ *colexec.andProjOp │ │ │ ├ *colexec.andProjOp │ │ │ │ ├ *colexec.andProjOp - │ │ │ │ │ ├ *colexecproj.projEQBytesBytesConstOp + │ │ │ │ │ ├ *colexecprojconst.projEQBytesBytesConstOp │ │ │ │ │ └ *colexec.projectInOpBytes - │ │ │ │ └ *colexecproj.projGEFloat64Float64ConstOp - │ │ │ └ *colexecproj.projLEFloat64Float64ConstOp - │ │ └ *colexecproj.projLEInt64Int64ConstOp + │ │ │ │ └ *colexecprojconst.projGEFloat64Float64ConstOp + │ │ │ └ *colexecprojconst.projLEFloat64Float64ConstOp + │ │ └ *colexecprojconst.projLEInt64Int64ConstOp │ └ *colexec.andProjOp │ ├ *colexec.andProjOp │ │ ├ *colexec.andProjOp │ │ │ ├ *colexec.andProjOp - │ │ │ │ ├ *colexecproj.projEQBytesBytesConstOp + │ │ │ │ ├ *colexecprojconst.projEQBytesBytesConstOp │ │ │ │ └ *colexec.projectInOpBytes - │ │ │ └ *colexecproj.projGEFloat64Float64ConstOp - │ │ └ *colexecproj.projLEFloat64Float64ConstOp - │ └ *colexecproj.projLEInt64Int64ConstOp + │ │ │ └ *colexecprojconst.projGEFloat64Float64ConstOp + │ │ └ *colexecprojconst.projLEFloat64Float64ConstOp + │ └ *colexecprojconst.projLEInt64Int64ConstOp ├ *colexecbase.constBoolOp │ └ *colexec.andProjOp │ ├ *colexec.bufferOp │ ├ *colexec.andProjOp │ │ ├ *colexec.andProjOp │ │ │ ├ *colexec.andProjOp - │ │ │ │ ├ *colexecproj.projEQBytesBytesConstOp + │ │ │ │ ├ *colexecprojconst.projEQBytesBytesConstOp │ │ │ │ └ *colexec.projectInOpBytes - │ │ │ └ *colexecproj.projGEFloat64Float64ConstOp - │ │ └ *colexecproj.projLEFloat64Float64ConstOp - │ └ *colexecproj.projLEInt64Int64ConstOp + │ │ │ └ *colexecprojconst.projGEFloat64Float64ConstOp + │ │ └ *colexecprojconst.projLEFloat64Float64ConstOp + │ └ *colexecprojconst.projLEInt64Int64ConstOp └ *colexecbase.constBoolOp └ *colexec.bufferOp @@ -20960,7 +20960,7 @@ EXPLAIN (VEC) SELECT s_name, s_address FROM supplier, nation WHERE s_suppkey IN └ *colexec.unorderedDistinct └ *rowexec.joinReader └ *colexecsel.selGTInt64Float64Op - └ *colexecproj.projMultFloat64Float64ConstOp + └ *colexecprojconst.projMultFloat64Float64ConstOp └ *colexec.hashAggregator └ *colexecjoin.hashJoiner ├ *colfetcher.ColIndexJoin diff --git a/pkg/sql/opt/exec/execbuilder/testdata/vectorize_local b/pkg/sql/opt/exec/execbuilder/testdata/vectorize_local index 0d4e922ade8a..e850d6d8e103 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/vectorize_local +++ b/pkg/sql/opt/exec/execbuilder/testdata/vectorize_local @@ -281,7 +281,7 @@ EXPLAIN (VEC) SELECT stddev((t46404_1.c0 > ANY (0, 0))::INT) FROM t46404_0, t464 └ Node 1 └ *colexec.hashAggregator └ *colexecbase.castBoolIntOp - └ *colexecproj.defaultCmpRConstProjOp + └ *colexecprojconst.defaultCmpRConstProjOp └ *colexecjoin.crossJoiner ├ *colfetcher.ColBatchScan └ *colfetcher.ColBatchScan @@ -328,7 +328,7 @@ EXPLAIN (VEC) SELECT _int2 * _int2 FROM ints WHERE _int4 + _int4 = _int8 + 2 └ *colexecbase.castInt2IntOp └ *colexecbase.castInt2IntOp └ *colexecsel.selEQInt64Int64Op - └ *colexecproj.projPlusInt64Int64ConstOp + └ *colexecprojconst.projPlusInt64Int64ConstOp └ *colexecproj.projPlusInt64Int64Op └ *colexecbase.castInt4IntOp └ *colexecbase.castInt4IntOp diff --git a/pkg/sql/opt/exec/execbuilder/testdata/vectorize_overloads b/pkg/sql/opt/exec/execbuilder/testdata/vectorize_overloads index a7104449b2e7..22b4b21eb8ca 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/vectorize_overloads +++ b/pkg/sql/opt/exec/execbuilder/testdata/vectorize_overloads @@ -169,7 +169,7 @@ EXPLAIN (VEC) SELECT _inet - 1 FROM many_types ---- │ └ Node 1 - └ *colexecproj.projMinusDatumInt64ConstOp + └ *colexecprojconst.projMinusDatumInt64ConstOp └ *colfetcher.ColBatchScan query T @@ -186,7 +186,7 @@ EXPLAIN (VEC) SELECT 2 + _inet FROM many_types ---- │ └ Node 1 - └ *colexecproj.projPlusDatumInt64ConstOp + └ *colexecprojconst.projPlusDatumInt64ConstOp └ *colfetcher.ColBatchScan query T @@ -242,7 +242,7 @@ EXPLAIN (VEC) SELECT _int << 1 FROM many_types ---- │ └ Node 1 - └ *colexecproj.projLShiftInt64Int64ConstOp + └ *colexecprojconst.projLShiftInt64Int64ConstOp └ *colfetcher.ColBatchScan query T @@ -250,7 +250,7 @@ EXPLAIN (VEC) SELECT _int >> 1 FROM many_types ---- │ └ Node 1 - └ *colexecproj.projRShiftInt64Int64ConstOp + └ *colexecprojconst.projRShiftInt64Int64ConstOp └ *colfetcher.ColBatchScan query T @@ -258,7 +258,7 @@ EXPLAIN (VEC) SELECT _varbit << 4 FROM many_types ---- │ └ Node 1 - └ *colexecproj.projLShiftDatumInt64ConstOp + └ *colexecprojconst.projLShiftDatumInt64ConstOp └ *colfetcher.ColBatchScan query T @@ -293,7 +293,7 @@ EXPLAIN (VEC) SELECT _varbit >> 4 FROM many_types ---- │ └ Node 1 - └ *colexecproj.projRShiftDatumInt64ConstOp + └ *colexecprojconst.projRShiftDatumInt64ConstOp └ *colfetcher.ColBatchScan query T @@ -353,7 +353,7 @@ EXPLAIN (VEC) SELECT _json -> 2 FROM many_types ---- │ └ Node 1 - └ *colexecproj.projJSONFetchValJSONInt64ConstOp + └ *colexecprojconst.projJSONFetchValJSONInt64ConstOp └ *colfetcher.ColBatchScan query T @@ -361,8 +361,8 @@ EXPLAIN (VEC) SELECT _json -> 2 -> 'a' FROM many_types ---- │ └ Node 1 - └ *colexecproj.projJSONFetchValJSONBytesConstOp - └ *colexecproj.projJSONFetchValJSONInt64ConstOp + └ *colexecprojconst.projJSONFetchValJSONBytesConstOp + └ *colexecprojconst.projJSONFetchValJSONInt64ConstOp └ *colfetcher.ColBatchScan query T @@ -370,7 +370,7 @@ EXPLAIN (VEC) SELECT _json #> _stringarray, _json #> '{a,b}' FROM many_types ---- │ └ Node 1 - └ *colexecproj.projJSONFetchValPathJSONDatumConstOp + └ *colexecprojconst.projJSONFetchValPathJSONDatumConstOp └ *colexecproj.projJSONFetchValPathJSONDatumOp └ *colfetcher.ColBatchScan @@ -379,9 +379,9 @@ EXPLAIN (VEC) SELECT _json #> _stringarray #> '{c}', _json #> '{a,b}' #> '{c}' F ---- │ └ Node 1 - └ *colexecproj.projJSONFetchValPathJSONDatumConstOp - └ *colexecproj.projJSONFetchValPathJSONDatumConstOp - └ *colexecproj.projJSONFetchValPathJSONDatumConstOp + └ *colexecprojconst.projJSONFetchValPathJSONDatumConstOp + └ *colexecprojconst.projJSONFetchValPathJSONDatumConstOp + └ *colexecprojconst.projJSONFetchValPathJSONDatumConstOp └ *colexecproj.projJSONFetchValPathJSONDatumOp └ *colfetcher.ColBatchScan @@ -390,7 +390,7 @@ EXPLAIN (VEC) SELECT _json #>> _stringarray, _json #>> '{a,b}' FROM many_types ---- │ └ Node 1 - └ *colexecproj.projJSONFetchTextPathJSONDatumConstOp + └ *colexecprojconst.projJSONFetchTextPathJSONDatumConstOp └ *colexecproj.projJSONFetchTextPathJSONDatumOp └ *colfetcher.ColBatchScan @@ -399,8 +399,8 @@ EXPLAIN (VEC) SELECT _json #> '{a,b}' #>> '{c}' FROM many_types ---- │ └ Node 1 - └ *colexecproj.projJSONFetchTextPathJSONDatumConstOp - └ *colexecproj.projJSONFetchValPathJSONDatumConstOp + └ *colexecprojconst.projJSONFetchTextPathJSONDatumConstOp + └ *colexecprojconst.projJSONFetchValPathJSONDatumConstOp └ *colfetcher.ColBatchScan # Make sure we fall back to row engine when we have a mixed-type expression @@ -420,7 +420,7 @@ EXPLAIN (VEC) SELECT '[2, "hi", {"b": ["bar", {"c": 4}]}]'::jsonb -> _int FROM m ---- │ └ Node 1 - └ *colexecproj.projJSONFetchValJSONConstInt64Op + └ *colexecprojconst.projJSONFetchValJSONConstInt64Op └ *colfetcher.ColBatchScan # Check that the comparison expressions with the constant on the left are @@ -431,7 +431,7 @@ EXPLAIN (VEC) SELECT B'11' <> _varbit FROM many_types ---- │ └ Node 1 - └ *colexecproj.projNEDatumDatumConstOp + └ *colexecprojconst.projNEDatumDatumConstOp └ *colfetcher.ColBatchScan query T