mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-23 10:27:34 -06:00
Tidying up
This commit is contained in:
@@ -749,8 +749,7 @@ func (idx uniqIndex) insertRow(ctx context.Context, key, value val.Tuple) error
|
||||
return err
|
||||
}
|
||||
|
||||
newValue := val.NewTuple(idx.secondary.NodeStore().Pool(), nil)
|
||||
return idx.secondary.Put(ctx, secondaryIndexKey, newValue)
|
||||
return idx.secondary.Put(ctx, secondaryIndexKey, val.EmptyTuple)
|
||||
}
|
||||
|
||||
func (idx uniqIndex) removeRow(ctx context.Context, key, value val.Tuple) error {
|
||||
|
||||
@@ -125,14 +125,9 @@ func (m MutableSecondaryIdx) UpdateEntry(ctx context.Context, key, currValue, ne
|
||||
|
||||
err = m.mut.Delete(ctx, currKey)
|
||||
if err != nil {
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
err = m.mut.Put(ctx, newKey, val.EmptyTuple)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return nil
|
||||
return m.mut.Put(ctx, newKey, val.EmptyTuple)
|
||||
}
|
||||
|
||||
// DeleteEntry deletes a secondary index entry given they key and value of the primary row.
|
||||
@@ -142,11 +137,7 @@ func (m MutableSecondaryIdx) DeleteEntry(ctx context.Context, key val.Tuple, val
|
||||
return err
|
||||
}
|
||||
|
||||
err = m.mut.Delete(ctx, currKey)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
return m.mut.Delete(ctx, currKey)
|
||||
}
|
||||
|
||||
// Map returns the finalized prolly.Map of the underlying prolly.MutableMap.
|
||||
|
||||
@@ -79,10 +79,16 @@ func (b SecondaryKeyBuilder) SecondaryKeyFromRow(ctx context.Context, k, v val.T
|
||||
for to := range b.mapping {
|
||||
from := b.mapping.MapOrdinal(to)
|
||||
if from < b.split {
|
||||
// the from field comes from the key tuple fields
|
||||
// the "from" field comes from the key tuple fields
|
||||
// NOTE: Because we are using Tuple.GetField and TupleBuilder.PutRaw, we are not
|
||||
// interpreting the tuple data at all and just copying the bytes. This should work
|
||||
// for primary keys since they are always represented in the secondary index exactly
|
||||
// as they are in the primary index, but for the value tuple, we need to interpret the
|
||||
// data so that we can transform StringAddrEnc fields from pointers to strings (i.e. for
|
||||
// prefix indexes) as well as custom handling for ZCell geometry fields.
|
||||
b.builder.PutRaw(to, k.GetField(from))
|
||||
} else {
|
||||
// the from field comes from the value tuple fields
|
||||
// the "from" field comes from the value tuple fields
|
||||
from -= b.split
|
||||
|
||||
value, err := GetField(ctx, b.sch.GetValueDescriptor(), from, v, b.nodeStore)
|
||||
|
||||
@@ -202,8 +202,7 @@ func BuildSecondaryProllyIndex(ctx context.Context, vrw types.ValueReadWriter, n
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
idxVal := val.EmptyTuple
|
||||
if err = mut.Put(ctx, idxKey, idxVal); err != nil {
|
||||
if err = mut.Put(ctx, idxKey, val.EmptyTuple); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -272,7 +271,6 @@ func BuildUniqueProllyIndex(ctx context.Context, vrw types.ValueReadWriter, ns t
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
idxVal := val.EmptyTuple
|
||||
|
||||
if prefixDesc.HasNulls(idxKey) {
|
||||
continue
|
||||
@@ -289,7 +287,7 @@ func BuildUniqueProllyIndex(ctx context.Context, vrw types.ValueReadWriter, ns t
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = mut.Put(ctx, idxKey, idxVal); err != nil {
|
||||
if err = mut.Put(ctx, idxKey, val.EmptyTuple); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,8 +489,7 @@ func testInternalNodeSplits(t *testing.T) {
|
||||
bld.PutInt32(0, int32(j))
|
||||
bld.PutInt32(1, int32(j))
|
||||
key := bld.Build(sharedPool)
|
||||
value := val.EmptyTuple
|
||||
err = mut.Put(ctx, key, value)
|
||||
err = mut.Put(ctx, key, val.EmptyTuple)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
pm, err = mut.Map(ctx)
|
||||
|
||||
Reference in New Issue
Block a user