-
-
Notifications
You must be signed in to change notification settings - Fork 514
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
fix keyless duplicate update #5514
Conversation
Does this also fix #5433 ? |
Nice catch, it looks like this does address #5433 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, small suggestion so that we don't have to add a cardinality offset every time we use the ordinality mapping
@@ -160,7 +160,8 @@ func (k prollyKeylessWriter) uniqueKeyError(ctx context.Context, keyStr string, | |||
vd := k.valBld.Desc | |||
for from := range k.valMap { | |||
to := k.valMap.MapOrdinal(from) | |||
if existing[to], err = index.GetField(ctx, vd, from, value, k.mut.NodeStore()); err != nil { | |||
// offset from index for keyless rows, as first field is the count | |||
if existing[to], err = index.GetField(ctx, vd, from+1, value, k.mut.NodeStore()); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be better for valMap to just have the right mappings, embed the cardinality offset so that other methods don't have to add 1 everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my initial approach, but I don't think the valMap
or the tuple descriptors can tell if the first field is encoding the cardinality or a column of type uint64. Maybe it's worth modifying them? or changing MapOrdinal
to take a keyless bool or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something like this?
func ordinalMappingsFromSchema(from sql.Schema, to schema.Schema) (km, vm val.OrdinalMapping) {
keyless := schema.IsKeyless(to)
km = makeOrdinalMapping(from, to.GetPKCols(), keyless)
vm = makeOrdinalMapping(from, to.GetNonPKCols(), keyless)
return
}
fix for: #5442 and #5433
tests: dolthub/go-mysql-server#1642