Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support updating primary/unique key columns in new DML #20842

Merged
merged 7 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pkg/container/batch/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ import (
"bytes"
"context"
"fmt"
"github.com/matrixorigin/matrixone/pkg/common/bitmap"

"github.com/matrixorigin/matrixone/pkg/sql/colexec/aggexec"

"github.com/matrixorigin/matrixone/pkg/common/bitmap"
"github.com/matrixorigin/matrixone/pkg/common/moerr"
"github.com/matrixorigin/matrixone/pkg/common/mpool"
"github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/container/vector"
"github.com/matrixorigin/matrixone/pkg/sql/colexec/aggexec"
)

func New(attrs []string) *Batch {
Expand Down
18 changes: 9 additions & 9 deletions pkg/frontend/test/incrservice_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 9 additions & 14 deletions pkg/frontend/test/mock_incr/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions pkg/incrservice/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/matrixorigin/matrixone/pkg/common/log"
"github.com/matrixorigin/matrixone/pkg/common/moerr"
"github.com/matrixorigin/matrixone/pkg/common/stopper"
"github.com/matrixorigin/matrixone/pkg/container/batch"
"github.com/matrixorigin/matrixone/pkg/container/vector"
"github.com/matrixorigin/matrixone/pkg/defines"
"github.com/matrixorigin/matrixone/pkg/pb/timestamp"
"github.com/matrixorigin/matrixone/pkg/pb/txn"
Expand Down Expand Up @@ -220,7 +220,8 @@ func (s *service) GetLastAllocateTS(
func (s *service) InsertValues(
ctx context.Context,
tableID uint64,
bat *batch.Batch,
vecs []*vector.Vector,
rows int,
estimate int64,
) (uint64, error) {
ts, err := s.getCommittedTableCache(
Expand All @@ -232,7 +233,8 @@ func (s *service) InsertValues(
return ts.insertAutoValues(
ctx,
tableID,
bat,
vecs,
rows,
estimate,
)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/incrservice/table_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"sync"

"github.com/matrixorigin/matrixone/pkg/common/log"
"github.com/matrixorigin/matrixone/pkg/container/batch"
"github.com/matrixorigin/matrixone/pkg/container/vector"
"github.com/matrixorigin/matrixone/pkg/pb/timestamp"
"github.com/matrixorigin/matrixone/pkg/txn/client"
)
Expand Down Expand Up @@ -105,7 +105,8 @@ func (c *tableCache) getLastAllocateTS(colName string) (timestamp.Timestamp, err
func (c *tableCache) insertAutoValues(
ctx context.Context,
tableID uint64,
bat *batch.Batch,
vecs []*vector.Vector,
rows int,
estimate int64,
) (uint64, error) {
lastInsert := uint64(0)
Expand All @@ -120,8 +121,7 @@ func (c *tableCache) insertAutoValues(
cc.preAllocate(ctx, tableID, int(estimate), txnOp)
}

rows := bat.RowCount()
vec := bat.GetVector(int32(col.ColIndex))
vec := vecs[col.ColIndex]
if v, err := cc.insertAutoValues(ctx, tableID, vec, rows, txnOp); err != nil {
return 0, err
} else {
Expand Down
6 changes: 3 additions & 3 deletions pkg/incrservice/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"context"

"github.com/matrixorigin/matrixone/pkg/common/runtime"
"github.com/matrixorigin/matrixone/pkg/container/batch"
"github.com/matrixorigin/matrixone/pkg/container/vector"
"github.com/matrixorigin/matrixone/pkg/pb/plan"
"github.com/matrixorigin/matrixone/pkg/pb/timestamp"
"github.com/matrixorigin/matrixone/pkg/txn/client"
Expand Down Expand Up @@ -63,7 +63,7 @@ type AutoIncrementService interface {
// delete operation is triggered.
Delete(ctx context.Context, tableID uint64, txn client.TxnOperator) error
// InsertValues insert auto columns values into bat.
InsertValues(ctx context.Context, tableID uint64, bat *batch.Batch, estimate int64) (uint64, error)
InsertValues(ctx context.Context, tableID uint64, vecs []*vector.Vector, rows int, estimate int64) (uint64, error)
// CurrentValue return current incr column value.
CurrentValue(ctx context.Context, tableID uint64, col string) (uint64, error)
// Reload reload auto increment cache.
Expand Down Expand Up @@ -109,7 +109,7 @@ type incrTableCache interface {
table() uint64
commit()
columns() []AutoColumn
insertAutoValues(ctx context.Context, tableID uint64, bat *batch.Batch, estimate int64) (uint64, error)
insertAutoValues(ctx context.Context, tableID uint64, vecs []*vector.Vector, rows int, estimate int64) (uint64, error)
currentValue(ctx context.Context, tableID uint64, col string) (uint64, error)
getLastAllocateTS(colName string) (timestamp.Timestamp, error)
adjust(ctx context.Context, cols []AutoColumn) error
Expand Down
Loading
Loading