diff --git a/.github/scripts/sql-correctness/current_correctness.txt b/.github/scripts/sql-correctness/current_correctness.txt index 29d6383b52c..7a5bd63989e 100644 --- a/.github/scripts/sql-correctness/current_correctness.txt +++ b/.github/scripts/sql-correctness/current_correctness.txt @@ -1 +1 @@ -100 +99.806921 diff --git a/go/cmd/dolt/doltversion/version.go b/go/cmd/dolt/doltversion/version.go index c0532384c6b..a55fca35da0 100644 --- a/go/cmd/dolt/doltversion/version.go +++ b/go/cmd/dolt/doltversion/version.go @@ -15,5 +15,5 @@ package doltversion const ( - Version = "1.59.18" + Version = "99.99.99" ) diff --git a/go/go.mod b/go/go.mod index 7c87e4ed5c7..c93f93e0376 100644 --- a/go/go.mod +++ b/go/go.mod @@ -61,7 +61,7 @@ require ( github.com/dolthub/dolt-mcp v0.2.2-0.20250917171427-13e4520d1c36 github.com/dolthub/eventsapi_schema v0.0.0-20250915094920-eadfd39051ca github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.20.1-0.20251008205317-e24a6e840478 + github.com/dolthub/go-mysql-server v0.20.1-0.20251013222508-e994e25d6bae github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 github.com/edsrzf/mmap-go v1.2.0 github.com/esote/minmaxheap v1.0.0 diff --git a/go/go.sum b/go/go.sum index 0a90bd3131f..d6eb1d426ac 100644 --- a/go/go.sum +++ b/go/go.sum @@ -213,8 +213,8 @@ github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U= github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0= github.com/dolthub/go-icu-regex v0.0.0-20250916051405-78a38d478790 h1:zxMsH7RLiG+dlZ/y0LgJHTV26XoiSJcuWq+em6t6VVc= github.com/dolthub/go-icu-regex v0.0.0-20250916051405-78a38d478790/go.mod h1:F3cnm+vMRK1HaU6+rNqQrOCyR03HHhR1GWG2gnPOqaE= -github.com/dolthub/go-mysql-server v0.20.1-0.20251008205317-e24a6e840478 h1:9/iYF7y9cyD1TiEGMJIRo3VNlhNgtB2gNqlPPVATnr0= -github.com/dolthub/go-mysql-server v0.20.1-0.20251008205317-e24a6e840478/go.mod h1:EeYR0apo+8j2Dyxmn2ghkPlirO2S5mT1xHBrA+Efys8= +github.com/dolthub/go-mysql-server v0.20.1-0.20251013222508-e994e25d6bae h1:bvy3s+V5skuI3waIUnDgvN84qG0AUhoU+2AmNWZbXHo= +github.com/dolthub/go-mysql-server v0.20.1-0.20251013222508-e994e25d6bae/go.mod h1:EeYR0apo+8j2Dyxmn2ghkPlirO2S5mT1xHBrA+Efys8= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q= github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE= diff --git a/go/libraries/doltcore/sqle/enginetest/dolt_engine_test.go b/go/libraries/doltcore/sqle/enginetest/dolt_engine_test.go index 0775b08c5bb..9f8b0c63b92 100644 --- a/go/libraries/doltcore/sqle/enginetest/dolt_engine_test.go +++ b/go/libraries/doltcore/sqle/enginetest/dolt_engine_test.go @@ -113,53 +113,18 @@ func TestSchemaOverridesWithAdaptiveEncoding(t *testing.T) { // Convenience test for debugging a single query. Unskip and set to the desired query. func TestSingleScript(t *testing.T) { - t.Skip() + //t.Skip() var scripts = []queries.ScriptTest{ { Name: "Database syntax properly handles inter-CALL communication", SetUpScript: []string{ - `CREATE PROCEDURE p1() -BEGIN - DECLARE str VARCHAR(20); - CALL p2(str); - SET str = CONCAT('a', str); - SELECT str; -END`, - `CREATE PROCEDURE p2(OUT param VARCHAR(20)) -BEGIN - SET param = 'b'; -END`, - "CALL DOLT_ADD('-A');", - "CALL DOLT_COMMIT('-m', 'First procedures');", - "CALL DOLT_BRANCH('p12');", - "DROP PROCEDURE p1;", - "DROP PROCEDURE p2;", - `CREATE PROCEDURE p1() -BEGIN - DECLARE str VARCHAR(20); - CALL p2(str); - SET str = CONCAT('c', str); - SELECT str; -END`, - `CREATE PROCEDURE p2(OUT param VARCHAR(20)) -BEGIN - SET param = 'd'; -END`, - "CALL DOLT_ADD('-A');", - "CALL DOLT_COMMIT('-m', 'Second procedures');", + "create table t (i int primary key, j int);", + "insert into t values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);", }, Assertions: []queries.ScriptTestAssertion{ { - Query: "CALL p1();", - Expected: []sql.Row{{"cd"}}, - }, - { - Query: "CALL `mydb/main`.p1();", - Expected: []sql.Row{{"cd"}}, - }, - { - Query: "CALL `mydb/p12`.p1();", - Expected: []sql.Row{{"ab"}}, + Query: "select * from t where j > 2;", + Expected: []sql.Row{}, }, }, }, diff --git a/go/libraries/doltcore/sqle/index/prolly_index_iter.go b/go/libraries/doltcore/sqle/index/prolly_index_iter.go index bceae4597fd..ae70f794da9 100644 --- a/go/libraries/doltcore/sqle/index/prolly_index_iter.go +++ b/go/libraries/doltcore/sqle/index/prolly_index_iter.go @@ -16,6 +16,7 @@ package index import ( "context" + "github.com/dolthub/vitess/go/sqltypes" "io" "github.com/dolthub/go-mysql-server/sql" @@ -119,6 +120,53 @@ func (p prollyIndexIter) Next(ctx *sql.Context) (sql.Row, error) { return r, nil } +func (p prollyIndexIter) Next2(ctx *sql.Context) (sql.Row2, error) { + idxKey, _, err := p.indexIter.Next(ctx) + if err != nil { + return nil, err + } + for to := range p.pkMap { + from := p.pkMap.MapOrdinal(to) + p.pkBld.PutRaw(to, idxKey.GetField(from)) + } + pk, err := p.pkBld.Build(sharePool) + if err != nil { + return nil, err + } + + r := make(sql.Row2, len(p.projections)) + err = p.primary.Get(ctx, pk, func(key, value val.Tuple) error { + keyDesc, valDesc := p.primary.Descriptors() + for i, idx := range p.keyMap { + outputIdx := p.ordMap[i] + typ := val.EncToType[keyDesc.Types[idx].Enc] + field, err := tree.GetField2(ctx, keyDesc, idx, key, p.primary.NodeStore()) + if err != nil { + return err + } + r[outputIdx] = sqltypes.MakeTrusted(typ, field) + } + for i, idx := range p.valMap { + outputIdx := p.ordMap[len(p.keyMap)+i] + typ := val.EncToType[valDesc.Types[idx].Enc] + field, err := tree.GetField2(ctx, valDesc, idx, value, p.primary.NodeStore()) + if err != nil { + return err + } + r[outputIdx] = sqltypes.MakeTrusted(typ, field) + } + return nil + }) + if err != nil { + return nil, err + } + return r, nil +} + +func (p prollyIndexIter) IsRowIter2(ctx *sql.Context) bool { + return true +} + func (p prollyIndexIter) rowFromTuples(ctx context.Context, key, value val.Tuple, r sql.Row) (err error) { keyDesc, valDesc := p.primary.Descriptors() @@ -239,6 +287,40 @@ func (p prollyCoveringIndexIter) Next(ctx *sql.Context) (sql.Row, error) { return r, nil } +func (p prollyCoveringIndexIter) Next2(ctx *sql.Context) (sql.Row2, error) { + k, v, err := p.indexIter.Next(ctx) + if err != nil { + return nil, err + } + + row := make(sql.Row2, len(p.projections)) + for i, idx := range p.keyMap { + outputIdx := p.ordMap[i] + typ := val.EncToType[p.keyDesc.Types[idx].Enc] + field, err := tree.GetField2(ctx, p.keyDesc, idx, k, p.ns) + if err != nil { + return nil, err + } + row[outputIdx] = sqltypes.MakeTrusted(typ, field) + } + + for i, idx := range p.valMap { + outputIdx := p.ordMap[len(p.keyMap)+i] + typ := val.EncToType[p.valDesc.Types[idx].Enc] + field, err := tree.GetField2(ctx, p.valDesc, idx, v, p.ns) + if err != nil { + return nil, err + } + row[outputIdx] = sqltypes.MakeTrusted(typ, field) + } + + return row, nil +} + +func (p prollyCoveringIndexIter) IsRowIter2(ctx *sql.Context) bool { + return true +} + func (p prollyCoveringIndexIter) writeRowFromTuples(ctx context.Context, key, value val.Tuple, r sql.Row) (err error) { for i, idx := range p.keyMap { outputIdx := p.ordMap[i] @@ -301,6 +383,9 @@ type prollyKeylessIndexIter struct { ordMap val.OrdinalMapping valueDesc val.TupleDesc sqlSch sql.Schema + + card uint64 + curr sql.Row2 } var _ sql.RowIter = prollyKeylessIndexIter{} @@ -436,6 +521,52 @@ func (p prollyKeylessIndexIter) keylessRowsFromValueTuple(ctx context.Context, n return } +func (p prollyKeylessIndexIter) Next2(ctx *sql.Context) (sql.Row2, error) { + if p.card == 0 { + idxKey, _, err := p.indexIter.Next(ctx) + if err != nil { + return nil, err + } + for to := range p.clusteredMap { + from := p.clusteredMap.MapOrdinal(to) + p.clusteredBld.PutRaw(to, idxKey.GetField(from)) + } + pk, err := p.clusteredBld.Build(sharePool) + if err != nil { + return nil, err + } + + var value val.Tuple + err = p.clustered.Get(ctx, pk, func(k, v val.Tuple) error { + value = v + return nil + }) + if err != nil { + return nil, err + } + + p.card = val.ReadKeylessCardinality(value) + ns := p.clustered.NodeStore() + p.curr = make(sql.Row2, len(p.valueMap)) + for i, idx := range p.valueMap { + outputIdx := p.ordMap[i] + typ := val.EncToType[p.valueDesc.Types[idx].Enc] + field, err := tree.GetField2(ctx, p.valueDesc, idx, value, ns) + if err != nil { + return nil, err + } + p.curr[outputIdx] = sqltypes.MakeTrusted(typ, field) + } + } + + p.card-- + return p.curr, nil +} + +func (p prollyKeylessIndexIter) IsRowIter2(ctx *sql.Context) bool { + return true +} + func (p prollyKeylessIndexIter) Close(*sql.Context) error { return nil } diff --git a/go/libraries/doltcore/sqle/index/prolly_row_iter.go b/go/libraries/doltcore/sqle/index/prolly_row_iter.go index 48f8bcb4f79..685417651bd 100644 --- a/go/libraries/doltcore/sqle/index/prolly_row_iter.go +++ b/go/libraries/doltcore/sqle/index/prolly_row_iter.go @@ -16,6 +16,7 @@ package index import ( "github.com/dolthub/go-mysql-server/sql" + "github.com/dolthub/vitess/go/sqltypes" "github.com/dolthub/dolt/go/libraries/doltcore/schema" "github.com/dolthub/dolt/go/store/prolly" @@ -191,6 +192,39 @@ func (it prollyRowIter) Next(ctx *sql.Context) (sql.Row, error) { return row, nil } +func (it prollyRowIter) Next2(ctx *sql.Context) (sql.Row2, error) { + key, value, err := it.iter.Next(ctx) + if err != nil { + return nil, err + } + + row := make(sql.Row2, it.rowLen) + for i, idx := range it.keyProj { + outputIdx := it.ordProj[i] + typ := val.EncToType[it.keyDesc.Types[idx].Enc] + field, err := tree.GetField2(ctx, it.keyDesc, idx, key, it.ns) + if err != nil { + return nil, err + } + row[outputIdx] = sqltypes.MakeTrusted(typ, field) + } + + for i, idx := range it.valProj { + outputIdx := it.ordProj[len(it.keyProj)+i] + typ := val.EncToType[it.valDesc.Types[idx].Enc] + field, err := tree.GetField2(ctx, it.valDesc, idx, value, it.ns) + if err != nil { + return nil, err + } + row[outputIdx] = sqltypes.MakeTrusted(typ, field) + } + return row, nil +} + +func (it prollyRowIter) IsRowIter2(ctx *sql.Context) bool { + return true +} + func (it prollyRowIter) Close(ctx *sql.Context) error { return nil } @@ -202,6 +236,7 @@ type prollyKeylessIter struct { valProj []int ordProj []int curr sql.Row + curr2 sql.Row2 rowLen int card uint64 } @@ -241,6 +276,33 @@ func (it *prollyKeylessIter) nextTuple(ctx *sql.Context) error { return nil } +func (it *prollyKeylessIter) Next2(ctx *sql.Context) (sql.Row2, error) { + if it.card == 0 { + _, value, err := it.iter.Next(ctx) + if err != nil { + return nil, err + } + + it.card = val.ReadKeylessCardinality(value) + it.curr2 = make(sql.Row2, it.rowLen) + for i, idx := range it.valProj { + outputIdx := it.ordProj[i] + typ := val.EncToType[it.valDesc.Types[idx].Enc] + field, err := tree.GetField2(ctx, it.valDesc, idx, value, it.ns) + if err != nil { + return nil, err + } + it.curr2[outputIdx] = sqltypes.MakeTrusted(typ, field) + } + } + it.card-- + return it.curr2, nil +} + +func (it *prollyKeylessIter) IsRowIter2(ctx *sql.Context) bool { + return true +} + func (it *prollyKeylessIter) Close(ctx *sql.Context) error { return nil } diff --git a/go/performance/microsysbench/sysbench_test.go b/go/performance/microsysbench/sysbench_test.go index 1d2a39c9681..bfe90e3fb60 100644 --- a/go/performance/microsysbench/sysbench_test.go +++ b/go/performance/microsysbench/sysbench_test.go @@ -57,12 +57,16 @@ func BenchmarkOltpPointSelect(b *testing.B) { }) } +// BenchmarkTableScan-14 589 1992973 ns/op 2948649 B/op 62181 allocs/op +// BenchmarkTableScan-14 900 1132013 ns/op 1842067 B/op 12363 allocs/op func BenchmarkTableScan(b *testing.B) { benchmarkSysbenchQuery(b, func(int) string { return "SELECT * FROM sbtest1" }) } +// BenchmarkOltpIndexScan-14 163 7324405 ns/op 2496428 B/op 70452 allocs/op +// BenchmarkOltpIndexScan-14 192 6092641 ns/op 1405302 B/op 20691 allocs/op func BenchmarkOltpIndexScan(b *testing.B) { benchmarkSysbenchQuery(b, func(int) string { return "SELECT * FROM sbtest1 WHERE k > 0" @@ -126,23 +130,36 @@ func benchmarkSysbenchQuery(b *testing.B, getQuery func(int) string) { for i := 0; i < b.N; i++ { schema, iter, _, err := eng.Query(ctx, getQuery(i)) require.NoError(b, err) - i := 0 - buf := sql.NewByteBuffer(16000) - for { - i++ - row, err := iter.Next(ctx) - if err != nil { - break + if ri2, ok := iter.(sql.RowIter2); ok && ri2.IsRowIter2(ctx) { + for { + row2, err := ri2.Next2(ctx) + if err != nil { + break + } + _ = row2 } - outputRow, err := server.RowToSQL(ctx, schema, row, nil, buf) - _ = outputRow - if i%128 == 0 { - buf.Reset() + require.Error(b, io.EOF) + err = ri2.Close(ctx) + require.NoError(b, err) + } else { + idx := 0 + buf := sql.NewByteBuffer(16000) + for { + idx++ + row, err := iter.Next(ctx) + if err != nil { + break + } + outputRow, err := server.RowToSQL(ctx, schema, row, nil, buf) + _ = outputRow + if idx%128 == 0 { + buf.Reset() + } } + require.Error(b, io.EOF) + err = iter.Close(ctx) + require.NoError(b, err) } - require.Error(b, io.EOF) - err = iter.Close(ctx) - require.NoError(b, err) } _ = eng.Close() b.ReportAllocs() diff --git a/go/performance/scripts/local_sysbench.sh b/go/performance/scripts/local_sysbench.sh index 4b76bea6cf2..bdd0d127d72 100755 --- a/go/performance/scripts/local_sysbench.sh +++ b/go/performance/scripts/local_sysbench.sh @@ -2,7 +2,7 @@ set -e set -o pipefail -SYSBENCH_TEST="oltp_point_select" +SYSBENCH_TEST="index_scan" WORKING_DIR=`mktemp -d` PPROF=0 PORT=3366 @@ -123,8 +123,11 @@ sysbench \ --mysql-user="$USER" \ --mysql-password="$PASS" \ --db-ps-mode=disable \ - --time=30 \ - --db-ps-mode=disable \ + --time=120 \ + --table-size=10000 \ + --percentile=50 \ + --rand-type=uniform \ + --rand-seed=1 \ "$SYSBENCH_TEST" run unset DOLT_ENABLE_CHUNK_JOURNAL diff --git a/go/store/prolly/tree/prolly_fields.go b/go/store/prolly/tree/prolly_fields.go index c57e795192c..aa2c98e5d41 100644 --- a/go/store/prolly/tree/prolly_fields.go +++ b/go/store/prolly/tree/prolly_fields.go @@ -20,6 +20,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/mohae/uvarint" "io" "math" "time" @@ -171,6 +172,77 @@ func GetField(ctx context.Context, td val.TupleDesc, i int, tup val.Tuple, ns No return v, err } +// GetField2 reads the value from the ith field of the Tuple as an interface{}. +func GetField2(ctx context.Context, td val.TupleDesc, i int, tup val.Tuple, ns NodeStore) (b []byte, err error) { + switch td.Types[i].Enc { + case val.Int8Enc, val.Int16Enc, val.Int32Enc, val.Int64Enc, + val.Uint8Enc, val.Uint16Enc, val.Uint32Enc, val.Uint64Enc, + val.Float32Enc, val.Float64Enc, val.DecimalEnc, val.Bit64Enc, + val.DateEnc, val.DatetimeEnc, val.TimeEnc, val.YearEnc, + val.EnumEnc, val.SetEnc, + val.Hash128Enc, val.CommitAddrEnc, val.CellEnc: + b = td.GetField(i, tup) + return b, nil + + case val.StringEnc, val.ByteStringEnc: + b = td.GetField(i, tup) + return b[:len(b)-1], nil // TODO: not sure why we do this? + + case val.JSONEnc, val.GeometryEnc: + b = td.GetField(i, tup) + return b[:len(b)-1], nil // TODO: not sure why we do this? + + case val.GeomAddrEnc: + // TODO: until GeometryEnc is removed, we must check if GeomAddrEnc is a GeometryEnc + var ok bool + if b, ok = td.GetGeometry(i, tup); ok { + return b[:len(b)-1], nil + } + var h hash.Hash + if h, ok = td.GetGeometryAddr(i, tup); ok { + b, err = ns.ReadBytes(ctx, h) + if err != nil { + return nil, err + } + return b, nil + } + // TODO: somehow neither Geometry or GeometryAddr, silently pass for now + return b, nil + + // TODO: figure out how to utilize with TextStorage, instead of always deserializing + case val.StringAddrEnc, val.BytesAddrEnc, val.JSONAddrEnc: + h := hash.New(td.GetField(i, tup)) + b, err = ns.ReadBytes(ctx, h) + if err != nil { + return nil, err + } + return b, nil + + case val.BytesAdaptiveEnc, val.StringAdaptiveEnc: + b = td.GetField(i, tup) + // null value + if len(b) == 0 { + return b, nil + } + // inlined + if b[0] == 0 { + return b[1:], nil + } + // out-of-band + _, lengthBytes := uvarint.Uvarint(b) + b, err = ns.ReadBytes(ctx, hash.New(b[lengthBytes:])) + return b, err + + // TODO: figure out how to deal with ExtendedEncs + case val.ExtendedEnc, val.ExtendedAddrEnc, val.ExtendedAdaptiveEnc: + b = td.GetField(i, tup) + return b, nil + + default: + panic("unknown val.encoding") + } +} + // Serialize writes an interface{} into the byte string representation used in val.Tuple, and returns the byte string, // and a boolean indicating success. func Serialize(ctx context.Context, ns NodeStore, t val.Type, v interface{}) (result []byte, err error) { diff --git a/go/store/val/codec.go b/go/store/val/codec.go index c85d784e40d..bbeade544e9 100644 --- a/go/store/val/codec.go +++ b/go/store/val/codec.go @@ -24,10 +24,11 @@ import ( "time" "unsafe" + querypb "github.com/dolthub/vitess/go/vt/proto/query" + "github.com/shopspring/decimal" + "github.com/dolthub/dolt/go/gen/fb/serial" "github.com/dolthub/dolt/go/store/hash" - - "github.com/shopspring/decimal" ) type Type struct { @@ -103,6 +104,52 @@ const ( sentinel Encoding = 127 ) +var EncToType = map[Encoding]querypb.Type{ + NullEnc: querypb.Type_NULL_TYPE, + Int8Enc: querypb.Type_INT8, + Int16Enc: querypb.Type_INT16, + Int32Enc: querypb.Type_INT32, + Int64Enc: querypb.Type_INT64, + Uint32Enc: querypb.Type_UINT32, + Uint16Enc: querypb.Type_UINT16, + Uint8Enc: querypb.Type_UINT8, + Uint64Enc: querypb.Type_UINT64, + + Float32Enc: querypb.Type_FLOAT32, + Float64Enc: querypb.Type_FLOAT64, + DecimalEnc: querypb.Type_DECIMAL, + Bit64Enc: querypb.Type_INT64, + + DateEnc: querypb.Type_DATE, + DatetimeEnc: querypb.Type_DATETIME, + TimeEnc: querypb.Type_TIME, + YearEnc: querypb.Type_YEAR, + + EnumEnc: querypb.Type_ENUM, + SetEnc: querypb.Type_SET, + + Hash128Enc: querypb.Type_BLOB, + CommitAddrEnc: querypb.Type_BLOB, + CellEnc: querypb.Type_BLOB, + + StringEnc: querypb.Type_TEXT, + ByteStringEnc: querypb.Type_TEXT, + + JSONEnc: querypb.Type_JSON, + GeometryEnc: querypb.Type_GEOMETRY, + GeomAddrEnc: querypb.Type_GEOMETRY, + + BytesAddrEnc: querypb.Type_BLOB, + StringAddrEnc: querypb.Type_BLOB, + BytesAdaptiveEnc: querypb.Type_BLOB, + StringAdaptiveEnc: querypb.Type_BLOB, + JSONAddrEnc: querypb.Type_BLOB, + + ExtendedEnc: querypb.Type_BLOB, + ExtendedAddrEnc: querypb.Type_BLOB, + ExtendedAdaptiveEnc: querypb.Type_BLOB, +} + func IsAddrEncoding(enc Encoding) bool { switch enc { case BytesAddrEnc, diff --git a/go/store/val/tuple_builder.go b/go/store/val/tuple_builder.go index 7726935977a..ab53d05bb4a 100644 --- a/go/store/val/tuple_builder.go +++ b/go/store/val/tuple_builder.go @@ -195,7 +195,7 @@ func (tb *TupleBuilder) addSize(sz ByteSize) { // PutBool writes a bool to the ith field of the Tuple being built. func (tb *TupleBuilder) PutBool(i int, v bool) { - tb.Desc.expectEncoding(i, Int8Enc) + tb.Desc.ExpectEncoding(i, Int8Enc) tb.ensureCapacity(int8Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(int8Size)] writeBool(tb.fields[i], v) @@ -205,7 +205,7 @@ func (tb *TupleBuilder) PutBool(i int, v bool) { // PutInt8 writes an int8 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutInt8(i int, v int8) { - tb.Desc.expectEncoding(i, Int8Enc) + tb.Desc.ExpectEncoding(i, Int8Enc) tb.ensureCapacity(int8Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(int8Size)] writeInt8(tb.fields[i], v) @@ -215,7 +215,7 @@ func (tb *TupleBuilder) PutInt8(i int, v int8) { // PutUint8 writes a uint8 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutUint8(i int, v uint8) { - tb.Desc.expectEncoding(i, Uint8Enc) + tb.Desc.ExpectEncoding(i, Uint8Enc) tb.ensureCapacity(uint8Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(1)] writeUint8(tb.fields[i], v) @@ -225,7 +225,7 @@ func (tb *TupleBuilder) PutUint8(i int, v uint8) { // PutInt16 writes an int16 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutInt16(i int, v int16) { - tb.Desc.expectEncoding(i, Int16Enc) + tb.Desc.ExpectEncoding(i, Int16Enc) tb.ensureCapacity(int16Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(int16Size)] writeInt16(tb.fields[i], v) @@ -235,7 +235,7 @@ func (tb *TupleBuilder) PutInt16(i int, v int16) { // PutUint16 writes a uint16 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutUint16(i int, v uint16) { - tb.Desc.expectEncoding(i, Uint16Enc) + tb.Desc.ExpectEncoding(i, Uint16Enc) tb.ensureCapacity(uint16Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(uint16Size)] WriteUint16(tb.fields[i], v) @@ -245,7 +245,7 @@ func (tb *TupleBuilder) PutUint16(i int, v uint16) { // PutInt32 writes an int32 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutInt32(i int, v int32) { - tb.Desc.expectEncoding(i, Int32Enc) + tb.Desc.ExpectEncoding(i, Int32Enc) tb.ensureCapacity(int32Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(int32Size)] writeInt32(tb.fields[i], v) @@ -255,7 +255,7 @@ func (tb *TupleBuilder) PutInt32(i int, v int32) { // PutUint32 writes a uint32 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutUint32(i int, v uint32) { - tb.Desc.expectEncoding(i, Uint32Enc) + tb.Desc.ExpectEncoding(i, Uint32Enc) tb.ensureCapacity(uint32Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(uint32Size)] writeUint32(tb.fields[i], v) @@ -265,7 +265,7 @@ func (tb *TupleBuilder) PutUint32(i int, v uint32) { // PutInt64 writes an int64 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutInt64(i int, v int64) { - tb.Desc.expectEncoding(i, Int64Enc) + tb.Desc.ExpectEncoding(i, Int64Enc) tb.ensureCapacity(int64Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(int64Size)] writeInt64(tb.fields[i], v) @@ -275,7 +275,7 @@ func (tb *TupleBuilder) PutInt64(i int, v int64) { // PutUint64 writes a uint64 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutUint64(i int, v uint64) { - tb.Desc.expectEncoding(i, Uint64Enc) + tb.Desc.ExpectEncoding(i, Uint64Enc) tb.ensureCapacity(uint64Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(uint64Size)] writeUint64(tb.fields[i], v) @@ -285,7 +285,7 @@ func (tb *TupleBuilder) PutUint64(i int, v uint64) { // PutFloat32 writes a float32 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutFloat32(i int, v float32) { - tb.Desc.expectEncoding(i, Float32Enc) + tb.Desc.ExpectEncoding(i, Float32Enc) tb.ensureCapacity(float32Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(float32Size)] writeFloat32(tb.fields[i], v) @@ -295,7 +295,7 @@ func (tb *TupleBuilder) PutFloat32(i int, v float32) { // PutFloat64 writes a float64 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutFloat64(i int, v float64) { - tb.Desc.expectEncoding(i, Float64Enc) + tb.Desc.ExpectEncoding(i, Float64Enc) tb.ensureCapacity(float64Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(float64Size)] writeFloat64(tb.fields[i], v) @@ -304,7 +304,7 @@ func (tb *TupleBuilder) PutFloat64(i int, v float64) { } func (tb *TupleBuilder) PutBit(i int, v uint64) { - tb.Desc.expectEncoding(i, Bit64Enc) + tb.Desc.ExpectEncoding(i, Bit64Enc) tb.ensureCapacity(bit64Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(bit64Size)] writeBit64(tb.fields[i], v) @@ -313,7 +313,7 @@ func (tb *TupleBuilder) PutBit(i int, v uint64) { } func (tb *TupleBuilder) PutDecimal(i int, v decimal.Decimal) { - tb.Desc.expectEncoding(i, DecimalEnc) + tb.Desc.ExpectEncoding(i, DecimalEnc) sz := sizeOfDecimal(v) tb.ensureCapacity(sz) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(sz)] @@ -324,7 +324,7 @@ func (tb *TupleBuilder) PutDecimal(i int, v decimal.Decimal) { // PutYear writes an int16-encoded year to the ith field of the Tuple being built. func (tb *TupleBuilder) PutYear(i int, v int16) { - tb.Desc.expectEncoding(i, YearEnc) + tb.Desc.ExpectEncoding(i, YearEnc) tb.ensureCapacity(yearSize) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(yearSize)] writeYear(tb.fields[i], v) @@ -333,7 +333,7 @@ func (tb *TupleBuilder) PutYear(i int, v int16) { } func (tb *TupleBuilder) PutDate(i int, v time.Time) { - tb.Desc.expectEncoding(i, DateEnc) + tb.Desc.ExpectEncoding(i, DateEnc) tb.ensureCapacity(dateSize) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(dateSize)] writeDate(tb.fields[i], v) @@ -343,7 +343,7 @@ func (tb *TupleBuilder) PutDate(i int, v time.Time) { // PutSqlTime writes a string to the ith field of the Tuple being built. func (tb *TupleBuilder) PutSqlTime(i int, v int64) { - tb.Desc.expectEncoding(i, TimeEnc) + tb.Desc.ExpectEncoding(i, TimeEnc) tb.ensureCapacity(timeSize) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(timeSize)] writeTime(tb.fields[i], v) @@ -352,7 +352,7 @@ func (tb *TupleBuilder) PutSqlTime(i int, v int64) { } func (tb *TupleBuilder) PutDatetime(i int, v time.Time) { - tb.Desc.expectEncoding(i, DatetimeEnc) + tb.Desc.ExpectEncoding(i, DatetimeEnc) tb.ensureCapacity(datetimeSize) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(datetimeSize)] writeDatetime(tb.fields[i], v) @@ -361,7 +361,7 @@ func (tb *TupleBuilder) PutDatetime(i int, v time.Time) { } func (tb *TupleBuilder) PutEnum(i int, v uint16) { - tb.Desc.expectEncoding(i, EnumEnc) + tb.Desc.ExpectEncoding(i, EnumEnc) tb.ensureCapacity(enumSize) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(enumSize)] writeEnum(tb.fields[i], v) @@ -371,7 +371,7 @@ func (tb *TupleBuilder) PutEnum(i int, v uint16) { } func (tb *TupleBuilder) PutSet(i int, v uint64) { - tb.Desc.expectEncoding(i, SetEnc) + tb.Desc.ExpectEncoding(i, SetEnc) tb.ensureCapacity(setSize) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(setSize)] writeSet(tb.fields[i], v) @@ -382,7 +382,7 @@ func (tb *TupleBuilder) PutSet(i int, v uint64) { // PutString writes a string to the ith field of the Tuple being built. func (tb *TupleBuilder) PutString(i int, v string) error { - tb.Desc.expectEncoding(i, StringEnc) + tb.Desc.ExpectEncoding(i, StringEnc) sz := ByteSize(len(v)) + 1 offSz := 0 if i > 0 { @@ -401,7 +401,7 @@ func (tb *TupleBuilder) PutString(i int, v string) error { // PutByteString writes a []byte to the ith field of the Tuple being built. func (tb *TupleBuilder) PutByteString(i int, v []byte) { - tb.Desc.expectEncoding(i, ByteStringEnc) + tb.Desc.ExpectEncoding(i, ByteStringEnc) sz := ByteSize(len(v)) + 1 tb.ensureCapacity(sz) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(sz)] @@ -412,7 +412,7 @@ func (tb *TupleBuilder) PutByteString(i int, v []byte) { // PutJSON writes a []byte to the ith field of the Tuple being built. func (tb *TupleBuilder) PutJSON(i int, v []byte) { - tb.Desc.expectEncoding(i, JSONEnc) + tb.Desc.ExpectEncoding(i, JSONEnc) sz := ByteSize(len(v)) + 1 tb.ensureCapacity(sz) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(sz)] @@ -423,7 +423,7 @@ func (tb *TupleBuilder) PutJSON(i int, v []byte) { // PutGeometry writes a []byte to the ith field of the Tuple being built. func (tb *TupleBuilder) PutGeometry(i int, v []byte) { - tb.Desc.expectEncoding(i, GeometryEnc) + tb.Desc.ExpectEncoding(i, GeometryEnc) sz := ByteSize(len(v)) + 1 tb.ensureCapacity(sz) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(sz)] @@ -434,14 +434,14 @@ func (tb *TupleBuilder) PutGeometry(i int, v []byte) { // PutGeometryAddr writes a Geometry's address ref to the ith field func (tb *TupleBuilder) PutGeometryAddr(i int, v hash.Hash) { - tb.Desc.expectEncoding(i, GeomAddrEnc) + tb.Desc.ExpectEncoding(i, GeomAddrEnc) tb.ensureCapacity(hash.ByteLen) tb.putAddr(i, v) } // PutHash128 writes a hash128 to the ith field of the Tuple being built. func (tb *TupleBuilder) PutHash128(i int, v []byte) { - tb.Desc.expectEncoding(i, Hash128Enc) + tb.Desc.ExpectEncoding(i, Hash128Enc) tb.ensureCapacity(hash128Size) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(hash128Size)] writeHash128(tb.fields[i], v) @@ -451,7 +451,7 @@ func (tb *TupleBuilder) PutHash128(i int, v []byte) { // PutExtended writes a []byte to the ith field of the Tuple being built. func (tb *TupleBuilder) PutExtended(i int, v []byte) { - tb.Desc.expectEncoding(i, ExtendedEnc) + tb.Desc.ExpectEncoding(i, ExtendedEnc) sz := ByteSize(len(v)) tb.ensureCapacity(sz) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(sz)] @@ -462,7 +462,7 @@ func (tb *TupleBuilder) PutExtended(i int, v []byte) { // PutExtendedAddr writes a []byte to the ith field of the Tuple being built. func (tb *TupleBuilder) PutExtendedAddr(i int, v hash.Hash) { - tb.Desc.expectEncoding(i, ExtendedAddrEnc) + tb.Desc.ExpectEncoding(i, ExtendedAddrEnc) tb.ensureCapacity(hash.ByteLen) tb.putAddr(i, v) } @@ -485,7 +485,7 @@ func (tb *TupleBuilder) PutRaw(i int, buf []byte) { // PutCommitAddr writes a commit's address ref to the ith field // of the Tuple being built. func (tb *TupleBuilder) PutCommitAddr(i int, v hash.Hash) { - tb.Desc.expectEncoding(i, CommitAddrEnc) + tb.Desc.ExpectEncoding(i, CommitAddrEnc) tb.ensureCapacity(hash.ByteLen) tb.putAddr(i, v) } @@ -493,7 +493,7 @@ func (tb *TupleBuilder) PutCommitAddr(i int, v hash.Hash) { // PutBytesAddr writes a blob's address ref to the ith field // of the Tuple being built. func (tb *TupleBuilder) PutBytesAddr(i int, v hash.Hash) { - tb.Desc.expectEncoding(i, BytesAddrEnc) + tb.Desc.ExpectEncoding(i, BytesAddrEnc) tb.ensureCapacity(hash.ByteLen) tb.putAddr(i, v) } @@ -501,7 +501,7 @@ func (tb *TupleBuilder) PutBytesAddr(i int, v hash.Hash) { // PutStringAddr writes a string's address ref to the ith field // of the Tuple being built. func (tb *TupleBuilder) PutStringAddr(i int, v hash.Hash) { - tb.Desc.expectEncoding(i, StringAddrEnc) + tb.Desc.ExpectEncoding(i, StringAddrEnc) tb.ensureCapacity(hash.ByteLen) tb.putAddr(i, v) } @@ -509,7 +509,7 @@ func (tb *TupleBuilder) PutStringAddr(i int, v hash.Hash) { // PutJSONAddr writes a JSON string's address ref to the ith field // of the Tuple being built. func (tb *TupleBuilder) PutJSONAddr(i int, v hash.Hash) { - tb.Desc.expectEncoding(i, JSONAddrEnc) + tb.Desc.ExpectEncoding(i, JSONAddrEnc) tb.ensureCapacity(hash.ByteLen) tb.putAddr(i, v) } @@ -532,7 +532,7 @@ func (tb *TupleBuilder) ensureCapacity(sz ByteSize) { // PutCell writes a Cell to the ith field of the Tuple being built. func (tb *TupleBuilder) PutCell(i int, v Cell) { - tb.Desc.expectEncoding(i, CellEnc) + tb.Desc.ExpectEncoding(i, CellEnc) tb.ensureCapacity(cellSize) tb.fields[i] = tb.buf[tb.pos : tb.pos+int64(cellSize)] writeCell(tb.fields[i], v) @@ -541,17 +541,17 @@ func (tb *TupleBuilder) PutCell(i int, v Cell) { } func (tb *TupleBuilder) PutAdaptiveBytesFromInline(ctx context.Context, i int, v []byte) error { - tb.Desc.expectEncoding(i, BytesAdaptiveEnc) + tb.Desc.ExpectEncoding(i, BytesAdaptiveEnc) return tb.PutAdaptiveFromInline(ctx, i, v) } func (tb *TupleBuilder) PutAdaptiveStringFromInline(ctx context.Context, i int, s string) error { - tb.Desc.expectEncoding(i, StringAdaptiveEnc) + tb.Desc.ExpectEncoding(i, StringAdaptiveEnc) return tb.PutAdaptiveFromInline(ctx, i, []byte(s)) } func (tb *TupleBuilder) PutAdaptiveExtendedFromInline(ctx context.Context, i int, v []byte) error { - tb.Desc.expectEncoding(i, ExtendedAdaptiveEnc) + tb.Desc.ExpectEncoding(i, ExtendedAdaptiveEnc) return tb.PutAdaptiveFromInline(ctx, i, v) } @@ -608,17 +608,17 @@ func (tb *TupleBuilder) PutAdaptiveValue(ctx context.Context, vs ValueStore, i i } func (tb *TupleBuilder) PutAdaptiveExtendedFromOutline(i int, v *ExtendedValueWrapper) { - tb.Desc.expectEncoding(i, ExtendedAdaptiveEnc) + tb.Desc.ExpectEncoding(i, ExtendedAdaptiveEnc) tb.PutAdaptiveFromOutline(i, v.outOfBandLength, v.Addr) } func (tb *TupleBuilder) PutAdaptiveBytesFromOutline(i int, v *ByteArray) { - tb.Desc.expectEncoding(i, BytesAdaptiveEnc) + tb.Desc.ExpectEncoding(i, BytesAdaptiveEnc) tb.PutAdaptiveFromOutline(i, v.maxByteLength, v.Addr) } func (tb *TupleBuilder) PutAdaptiveStringFromOutline(i int, v *TextStorage) { - tb.Desc.expectEncoding(i, StringAdaptiveEnc) + tb.Desc.ExpectEncoding(i, StringAdaptiveEnc) tb.PutAdaptiveFromOutline(i, v.maxByteLength, v.Addr) } diff --git a/go/store/val/tuple_descriptor.go b/go/store/val/tuple_descriptor.go index f1c7035322b..92923c2c117 100644 --- a/go/store/val/tuple_descriptor.go +++ b/go/store/val/tuple_descriptor.go @@ -228,7 +228,7 @@ func (td TupleDesc) WithoutFixedAccess() TupleDesc { // GetBool reads a bool from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetBool(i int, tup Tuple) (v bool, ok bool) { - td.expectEncoding(i, Int8Enc) + td.ExpectEncoding(i, Int8Enc) b := td.GetField(i, tup) if b != nil { v, ok = readBool(b), true @@ -239,7 +239,7 @@ func (td TupleDesc) GetBool(i int, tup Tuple) (v bool, ok bool) { // GetInt8 reads an int8 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetInt8(i int, tup Tuple) (v int8, ok bool) { - td.expectEncoding(i, Int8Enc) + td.ExpectEncoding(i, Int8Enc) b := td.GetField(i, tup) if b != nil { v, ok = readInt8(b), true @@ -250,7 +250,7 @@ func (td TupleDesc) GetInt8(i int, tup Tuple) (v int8, ok bool) { // GetUint8 reads a uint8 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetUint8(i int, tup Tuple) (v uint8, ok bool) { - td.expectEncoding(i, Uint8Enc) + td.ExpectEncoding(i, Uint8Enc) b := td.GetField(i, tup) if b != nil { v, ok = readUint8(b), true @@ -261,7 +261,7 @@ func (td TupleDesc) GetUint8(i int, tup Tuple) (v uint8, ok bool) { // GetInt16 reads an int16 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetInt16(i int, tup Tuple) (v int16, ok bool) { - td.expectEncoding(i, Int16Enc) + td.ExpectEncoding(i, Int16Enc) b := td.GetField(i, tup) if b != nil { v, ok = readInt16(b), true @@ -272,7 +272,7 @@ func (td TupleDesc) GetInt16(i int, tup Tuple) (v int16, ok bool) { // GetUint16 reads a uint16 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetUint16(i int, tup Tuple) (v uint16, ok bool) { - td.expectEncoding(i, Uint16Enc) + td.ExpectEncoding(i, Uint16Enc) b := td.GetField(i, tup) if b != nil { v, ok = ReadUint16(b), true @@ -283,7 +283,7 @@ func (td TupleDesc) GetUint16(i int, tup Tuple) (v uint16, ok bool) { // GetInt32 reads an int32 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetInt32(i int, tup Tuple) (v int32, ok bool) { - td.expectEncoding(i, Int32Enc) + td.ExpectEncoding(i, Int32Enc) b := td.GetField(i, tup) if b != nil { v, ok = readInt32(b), true @@ -294,7 +294,7 @@ func (td TupleDesc) GetInt32(i int, tup Tuple) (v int32, ok bool) { // GetUint32 reads a uint32 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetUint32(i int, tup Tuple) (v uint32, ok bool) { - td.expectEncoding(i, Uint32Enc) + td.ExpectEncoding(i, Uint32Enc) b := td.GetField(i, tup) if b != nil { v, ok = ReadUint32(b), true @@ -305,7 +305,7 @@ func (td TupleDesc) GetUint32(i int, tup Tuple) (v uint32, ok bool) { // GetInt64 reads an int64 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetInt64(i int, tup Tuple) (v int64, ok bool) { - td.expectEncoding(i, Int64Enc) + td.ExpectEncoding(i, Int64Enc) b := td.GetField(i, tup) if b != nil { v, ok = readInt64(b), true @@ -316,7 +316,7 @@ func (td TupleDesc) GetInt64(i int, tup Tuple) (v int64, ok bool) { // GetUint64 reads a uint64 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetUint64(i int, tup Tuple) (v uint64, ok bool) { - td.expectEncoding(i, Uint64Enc) + td.ExpectEncoding(i, Uint64Enc) b := td.GetField(i, tup) if b != nil { v, ok = readUint64(b), true @@ -327,7 +327,7 @@ func (td TupleDesc) GetUint64(i int, tup Tuple) (v uint64, ok bool) { // GetFloat32 reads a float32 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetFloat32(i int, tup Tuple) (v float32, ok bool) { - td.expectEncoding(i, Float32Enc) + td.ExpectEncoding(i, Float32Enc) b := td.GetField(i, tup) if b != nil { v, ok = readFloat32(b), true @@ -338,7 +338,7 @@ func (td TupleDesc) GetFloat32(i int, tup Tuple) (v float32, ok bool) { // GetFloat64 reads a float64 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetFloat64(i int, tup Tuple) (v float64, ok bool) { - td.expectEncoding(i, Float64Enc) + td.ExpectEncoding(i, Float64Enc) b := td.GetField(i, tup) if b != nil { v, ok = readFloat64(b), true @@ -349,7 +349,7 @@ func (td TupleDesc) GetFloat64(i int, tup Tuple) (v float64, ok bool) { // GetBit reads a uint64 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetBit(i int, tup Tuple) (v uint64, ok bool) { - td.expectEncoding(i, Bit64Enc) + td.ExpectEncoding(i, Bit64Enc) b := td.GetField(i, tup) if b != nil { v, ok = readBit64(b), true @@ -360,7 +360,7 @@ func (td TupleDesc) GetBit(i int, tup Tuple) (v uint64, ok bool) { // GetDecimal reads a float64 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetDecimal(i int, tup Tuple) (v decimal.Decimal, ok bool) { - td.expectEncoding(i, DecimalEnc) + td.ExpectEncoding(i, DecimalEnc) b := td.GetField(i, tup) if b != nil { v, ok = readDecimal(b), true @@ -371,7 +371,7 @@ func (td TupleDesc) GetDecimal(i int, tup Tuple) (v decimal.Decimal, ok bool) { // GetYear reads an int16 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetYear(i int, tup Tuple) (v int16, ok bool) { - td.expectEncoding(i, YearEnc) + td.ExpectEncoding(i, YearEnc) b := td.GetField(i, tup) if b != nil { v, ok = readYear(b), true @@ -382,7 +382,7 @@ func (td TupleDesc) GetYear(i int, tup Tuple) (v int16, ok bool) { // GetDate reads a time.Time from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetDate(i int, tup Tuple) (v time.Time, ok bool) { - td.expectEncoding(i, DateEnc) + td.ExpectEncoding(i, DateEnc) b := td.GetField(i, tup) if b != nil { v, ok = readDate(b), true @@ -393,7 +393,7 @@ func (td TupleDesc) GetDate(i int, tup Tuple) (v time.Time, ok bool) { // GetSqlTime reads an int64 encoded Time value, representing a duration as a number of microseconds, // from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetSqlTime(i int, tup Tuple) (v int64, ok bool) { - td.expectEncoding(i, TimeEnc) + td.ExpectEncoding(i, TimeEnc) b := td.GetField(i, tup) if b != nil { v, ok = readInt64(b), true @@ -404,7 +404,7 @@ func (td TupleDesc) GetSqlTime(i int, tup Tuple) (v int64, ok bool) { // GetDatetime reads a time.Time from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetDatetime(i int, tup Tuple) (v time.Time, ok bool) { - td.expectEncoding(i, DatetimeEnc) + td.ExpectEncoding(i, DatetimeEnc) b := td.GetField(i, tup) if b != nil { v, ok = readDatetime(b), true @@ -415,7 +415,7 @@ func (td TupleDesc) GetDatetime(i int, tup Tuple) (v time.Time, ok bool) { // GetEnum reads a uin16 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetEnum(i int, tup Tuple) (v uint16, ok bool) { - td.expectEncoding(i, EnumEnc) + td.ExpectEncoding(i, EnumEnc) b := td.GetField(i, tup) if b != nil { v, ok = readEnum(b), true @@ -426,7 +426,7 @@ func (td TupleDesc) GetEnum(i int, tup Tuple) (v uint16, ok bool) { // GetSet reads a uint64 from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetSet(i int, tup Tuple) (v uint64, ok bool) { - td.expectEncoding(i, SetEnc) + td.ExpectEncoding(i, SetEnc) b := td.GetField(i, tup) if b != nil { v, ok = readSet(b), true @@ -437,7 +437,7 @@ func (td TupleDesc) GetSet(i int, tup Tuple) (v uint64, ok bool) { // GetString reads a string from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetString(i int, tup Tuple) (v string, ok bool) { - td.expectEncoding(i, StringEnc) + td.ExpectEncoding(i, StringEnc) b := td.GetField(i, tup) if b != nil { v = readString(b) @@ -449,7 +449,7 @@ func (td TupleDesc) GetString(i int, tup Tuple) (v string, ok bool) { // GetBytes reads a []byte from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetBytes(i int, tup Tuple) (v []byte, ok bool) { - td.expectEncoding(i, ByteStringEnc) + td.ExpectEncoding(i, ByteStringEnc) b := td.GetField(i, tup) if b != nil { v = readByteString(b) @@ -461,7 +461,7 @@ func (td TupleDesc) GetBytes(i int, tup Tuple) (v []byte, ok bool) { // GetJSON reads a []byte from the ith field of the Tuple. // If the ith field is NULL, |ok| is set to false. func (td TupleDesc) GetJSON(i int, tup Tuple) (v []byte, ok bool) { - td.expectEncoding(i, JSONEnc) + td.ExpectEncoding(i, JSONEnc) b := td.GetField(i, tup) if b != nil { v = readByteString(b) @@ -490,7 +490,7 @@ func (td TupleDesc) GetGeometryAddr(i int, tup Tuple) (hash.Hash, bool) { } func (td TupleDesc) GetHash128(i int, tup Tuple) (v []byte, ok bool) { - td.expectEncoding(i, Hash128Enc) + td.ExpectEncoding(i, Hash128Enc) b := td.GetField(i, tup) if b != nil { v = b @@ -501,42 +501,42 @@ func (td TupleDesc) GetHash128(i int, tup Tuple) (v []byte, ok bool) { // GetExtended reads a byte slice from the ith field of the Tuple. func (td TupleDesc) GetExtended(i int, tup Tuple) ([]byte, bool) { - td.expectEncoding(i, ExtendedEnc) + td.ExpectEncoding(i, ExtendedEnc) v := td.GetField(i, tup) return v, v != nil } // GetExtendedAddr reads a hash from the ith field of the Tuple. func (td TupleDesc) GetExtendedAddr(i int, tup Tuple) (hash.Hash, bool) { - td.expectEncoding(i, ExtendedAddrEnc) + td.ExpectEncoding(i, ExtendedAddrEnc) return td.getAddr(i, tup) } // GetExtended reads a byte slice from the ith field of the Tuple. func (td TupleDesc) GetExtendedAdaptiveValue(i int, tup Tuple) ([]byte, bool) { - td.expectEncoding(i, ExtendedAdaptiveEnc) + td.ExpectEncoding(i, ExtendedAdaptiveEnc) v := td.GetField(i, tup) return v, v != nil } func (td TupleDesc) GetJSONAddr(i int, tup Tuple) (hash.Hash, bool) { - td.expectEncoding(i, JSONAddrEnc) + td.ExpectEncoding(i, JSONAddrEnc) return td.getAddr(i, tup) } func (td TupleDesc) GetStringAddr(i int, tup Tuple) (hash.Hash, bool) { - td.expectEncoding(i, StringAddrEnc) + td.ExpectEncoding(i, StringAddrEnc) return td.getAddr(i, tup) } func (td TupleDesc) GetBytesAddr(i int, tup Tuple) (hash.Hash, bool) { - td.expectEncoding(i, BytesAddrEnc) + td.ExpectEncoding(i, BytesAddrEnc) return td.getAddr(i, tup) } // GetBytesAdaptiveValue returns either a []byte or a BytesWrapper, but Go doesn't allow us to use a single type for that. func (td TupleDesc) GetBytesAdaptiveValue(ctx context.Context, i int, vs ValueStore, tup Tuple) (interface{}, bool, error) { - td.expectEncoding(i, BytesAdaptiveEnc) + td.ExpectEncoding(i, BytesAdaptiveEnc) return GetBytesAdaptiveValue(ctx, vs, td.GetField(i, tup)) } @@ -558,7 +558,7 @@ func GetBytesAdaptiveValue(ctx context.Context, vs ValueStore, val []byte) (inte func (td TupleDesc) GetStringAdaptiveValue(i int, vs ValueStore, tup Tuple) (interface{}, bool, error) { // TODO: Add context parameter ctx := context.Background() - td.expectEncoding(i, StringAdaptiveEnc) + td.ExpectEncoding(i, StringAdaptiveEnc) adaptiveValue := AdaptiveValue(td.GetField(i, tup)) if len(adaptiveValue) == 0 { return nil, false, nil @@ -573,7 +573,7 @@ func (td TupleDesc) GetStringAdaptiveValue(i int, vs ValueStore, tup Tuple) (int } func (td TupleDesc) GetCommitAddr(i int, tup Tuple) (v hash.Hash, ok bool) { - td.expectEncoding(i, CommitAddrEnc) + td.ExpectEncoding(i, CommitAddrEnc) return td.getAddr(i, tup) } @@ -585,7 +585,7 @@ func (td TupleDesc) getAddr(i int, tup Tuple) (hash.Hash, bool) { return hash.New(b), true } -func (td TupleDesc) expectEncoding(i int, encodings ...Encoding) { +func (td TupleDesc) ExpectEncoding(i int, encodings ...Encoding) { for _, enc := range encodings { if enc == td.Types[i].Enc { return @@ -595,7 +595,7 @@ func (td TupleDesc) expectEncoding(i int, encodings ...Encoding) { } func (td TupleDesc) GetCell(i int, tup Tuple) (v Cell, ok bool) { - td.expectEncoding(i, CellEnc) + td.ExpectEncoding(i, CellEnc) b := td.GetField(i, tup) if b != nil { v = readCell(b)