Commit ca6c6649 authored by Yahor Yuzefovich's avatar Yahor Yuzefovich

colexec: add support for bit and some arithmetic binary operators

This commit adds support for `Bitand`, `Bitor`, `Bitxor`, `FloorDiv`,
and `Mod` binary operators for both native and datum-backed types.

Release note (sql change): Vectorized execution engine now supports
`Bitand` (`&`), `Bitor` (`|`), `Bitxor` (`^`), `FloorDiv` (`//`), and
`Mod` (`%`) binary operators.
parent b973a823
......@@ -15,10 +15,15 @@ import "github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
// BinaryOpName is a mapping from all binary operators that are supported by
// the vectorized engine to their names.
var BinaryOpName = map[tree.BinaryOperator]string{
tree.Bitand: "Bitand",
tree.Bitor: "Bitor",
tree.Bitxor: "Bitxor",
tree.Plus: "Plus",
tree.Minus: "Minus",
tree.Mult: "Mult",
tree.Div: "Div",
tree.FloorDiv: "FloorDiv",
tree.Mod: "Mod",
tree.Concat: "Concat",
tree.JSONFetchVal: "JSONFetchVal",
}
......
......@@ -86,6 +86,21 @@ VALUES (
B'11'
)
query T
EXPLAIN (VEC) SELECT _inet & _inet FROM many_types
----
└ Node 1
└ *colexec.projBitandDatumDatumOp
└ *colexec.colBatchScan
query T rowsort
SELECT _inet & _inet FROM many_types
----
NULL
127.0.0.1
192.168.0.0/16
query T
EXPLAIN (VEC) SELECT _inet - _int2 FROM many_types
----
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment