diff --git a/go/cmd/dim/dim_row.go b/go/cmd/dim/dim_row.go index b1e7db6464..eaec8be72a 100644 --- a/go/cmd/dim/dim_row.go +++ b/go/cmd/dim/dim_row.go @@ -18,7 +18,7 @@ type DimRow struct { } func NewDimRow(r row.Row, toUntyped, toTyped *rowconv.RowConverter) (*DimRow, error) { - key := r.NomsMapKey(toUntyped.SrcSch).Value(context.Background()) + key := r.NomsMapKey(types.Format_7_18, toUntyped.SrcSch).Value(context.Background()) untyped, err := toUntyped.Convert(r) if err != nil { @@ -37,7 +37,7 @@ func (dr *DimRow) StoreValue(me *types.MapEditor) *types.MapEditor { } typedSch := dr.toTyped.DestSch - key := typed.NomsMapKey(typedSch).Value(context.Background()) + key := typed.NomsMapKey(types.Format_7_18, typedSch).Value(context.Background()) if !dr.key.Equals(types.Format_7_18, key) { me = me.Remove(dr.key) @@ -47,7 +47,7 @@ func (dr *DimRow) StoreValue(me *types.MapEditor) *types.MapEditor { dr.dbVals = dr.currentVals log.Println("stored vals") - return me.Set(key, typed.NomsMapValue(typedSch)) + return me.Set(key, typed.NomsMapValue(types.Format_7_18, typedSch)) } func (dr *DimRow) UpdateVal(tag uint64, str string) error { diff --git a/go/cmd/dolt/cli/arg_helpers.go b/go/cmd/dolt/cli/arg_helpers.go index 569eb96f1c..67b0cdd364 100644 --- a/go/cmd/dolt/cli/arg_helpers.go +++ b/go/cmd/dolt/cli/arg_helpers.go @@ -3,13 +3,14 @@ package cli import ( "context" "errors" + "os" + "strings" + "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore" "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/row" "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/schema" "github.com/liquidata-inc/ld/dolt/go/libraries/utils/argparser" "github.com/liquidata-inc/ld/dolt/go/store/types" - "os" - "strings" ) var ErrEmptyDefTuple = errors.New("empty definition tuple") @@ -156,7 +157,7 @@ func ParseKeyValues(sch schema.Schema, args []string) ([]types.Value, error) { taggedVals[k] = val } - pkVals = append(pkVals, taggedVals.NomsTupleForTags(pkCols.Tags, true).Value(context.TODO())) + pkVals = append(pkVals, taggedVals.NomsTupleForTags(types.Format_7_18, pkCols.Tags, true).Value(context.TODO())) } return pkVals, nil diff --git a/go/cmd/dolt/cli/arg_helpers_test.go b/go/cmd/dolt/cli/arg_helpers_test.go index 31e9a907e9..39aa597c7b 100644 --- a/go/cmd/dolt/cli/arg_helpers_test.go +++ b/go/cmd/dolt/cli/arg_helpers_test.go @@ -44,7 +44,7 @@ func TestParseKeyValues(t *testing.T) { singleKeySch, []string{"robertson"}, []types.Value{ - row.TaggedValues{lnColTag: types.String("robertson")}.NomsTupleForTags(singleKeyColColl.Tags, true).Value(ctx), + row.TaggedValues{lnColTag: types.String("robertson")}.NomsTupleForTags(types.Format_7_18, singleKeyColColl.Tags, true).Value(ctx), }, false, }, @@ -53,7 +53,7 @@ func TestParseKeyValues(t *testing.T) { singleKeySch, []string{"last", "robertson"}, []types.Value{ - row.TaggedValues{lnColTag: types.String("robertson")}.NomsTupleForTags(singleKeyColColl.Tags, true).Value(ctx), + row.TaggedValues{lnColTag: types.String("robertson")}.NomsTupleForTags(types.Format_7_18, singleKeyColColl.Tags, true).Value(ctx), }, false, }, @@ -67,7 +67,7 @@ func TestParseKeyValues(t *testing.T) { singleKeySch, []string{"last", "last"}, []types.Value{ - row.TaggedValues{lnColTag: types.String("last")}.NomsTupleForTags(singleKeyColColl.Tags, true).Value(ctx), + row.TaggedValues{lnColTag: types.String("last")}.NomsTupleForTags(types.Format_7_18, singleKeyColColl.Tags, true).Value(ctx), }, false, }, @@ -75,8 +75,8 @@ func TestParseKeyValues(t *testing.T) { singleKeySch, []string{"last", "robertson", "johnson"}, []types.Value{ - row.TaggedValues{lnColTag: types.String("robertson")}.NomsTupleForTags(singleKeyColColl.Tags, true).Value(ctx), - row.TaggedValues{lnColTag: types.String("johnson")}.NomsTupleForTags(singleKeyColColl.Tags, true).Value(ctx), + row.TaggedValues{lnColTag: types.String("robertson")}.NomsTupleForTags(types.Format_7_18, singleKeyColColl.Tags, true).Value(ctx), + row.TaggedValues{lnColTag: types.String("johnson")}.NomsTupleForTags(types.Format_7_18, singleKeyColColl.Tags, true).Value(ctx), }, false, }, @@ -91,8 +91,8 @@ func TestParseKeyValues(t *testing.T) { sch, []string{"last", "robertson", "johnson"}, []types.Value{ - row.TaggedValues{lnColTag: types.String("robertson")}.NomsTupleForTags(testKeyColColl.Tags, true).Value(ctx), - row.TaggedValues{lnColTag: types.String("johnson")}.NomsTupleForTags(testKeyColColl.Tags, true).Value(ctx), + row.TaggedValues{lnColTag: types.String("robertson")}.NomsTupleForTags(types.Format_7_18, testKeyColColl.Tags, true).Value(ctx), + row.TaggedValues{lnColTag: types.String("johnson")}.NomsTupleForTags(types.Format_7_18, testKeyColColl.Tags, true).Value(ctx), }, false, }, @@ -100,8 +100,8 @@ func TestParseKeyValues(t *testing.T) { sch, []string{"first,last", "robert,robertson", "john,johnson"}, []types.Value{ - row.TaggedValues{lnColTag: types.String("robertson"), fnColTag: types.String("robert")}.NomsTupleForTags(testKeyColColl.Tags, true).Value(ctx), - row.TaggedValues{lnColTag: types.String("johnson"), fnColTag: types.String("john")}.NomsTupleForTags(testKeyColColl.Tags, true).Value(ctx), + row.TaggedValues{lnColTag: types.String("robertson"), fnColTag: types.String("robert")}.NomsTupleForTags(types.Format_7_18, testKeyColColl.Tags, true).Value(ctx), + row.TaggedValues{lnColTag: types.String("johnson"), fnColTag: types.String("john")}.NomsTupleForTags(types.Format_7_18, testKeyColColl.Tags, true).Value(ctx), }, false, }, diff --git a/go/cmd/dolt/commands/sql.go b/go/cmd/dolt/commands/sql.go index 6c5a743d17..8d06545b02 100644 --- a/go/cmd/dolt/commands/sql.go +++ b/go/cmd/dolt/commands/sql.go @@ -23,6 +23,7 @@ import ( "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/table/untyped/tabular" "github.com/liquidata-inc/ld/dolt/go/libraries/utils/argparser" "github.com/liquidata-inc/ld/dolt/go/libraries/utils/iohelp" + "github.com/liquidata-inc/ld/dolt/go/store/types" "path/filepath" "strings" "vitess.io/vitess/go/vt/sqlparser" @@ -338,7 +339,7 @@ func runPrintingPipeline(p *pipeline.Pipeline, untypedSch schema.Schema) error { p.SetOutput(cliSink) p.SetBadRowCallback(func(tff *pipeline.TransformRowFailure) (quit bool) { - cli.PrintErrln(color.RedString("error: failed to transform row %s.", row.Fmt(context.Background(), tff.Row, untypedSch))) + cli.PrintErrln(color.RedString("error: failed to transform row %s.", row.Fmt(context.Background(), types.Format_7_18, tff.Row, untypedSch))) return true }) diff --git a/go/cmd/dolt/commands/sql_test.go b/go/cmd/dolt/commands/sql_test.go index f5d6a2746d..30a68d1bd2 100644 --- a/go/cmd/dolt/commands/sql_test.go +++ b/go/cmd/dolt/commands/sql_test.go @@ -309,7 +309,7 @@ func TestInsert(t *testing.T) { for _, expectedid := range test.expectedIds { table, _ := root.GetTable(context.Background(), tableName) taggedVals := row.TaggedValues{dtestutils.IdTag: types.UUID(expectedid)} - key := taggedVals.NomsTupleForTags([]uint64{dtestutils.IdTag}, true) + key := taggedVals.NomsTupleForTags(types.Format_7_18, []uint64{dtestutils.IdTag}, true) _, ok := table.GetRow(context.Background(), key.Value(context.Background()).(types.Tuple), dtestutils.TypedSchema) assert.True(t, ok, "expected id not found") } @@ -381,7 +381,7 @@ func TestUpdate(t *testing.T) { for i, expectedid := range test.expectedIds { table, _ := root.GetTable(context.Background(), tableName) taggedVals := row.TaggedValues{dtestutils.IdTag: types.UUID(expectedid)} - key := taggedVals.NomsTupleForTags([]uint64{dtestutils.IdTag}, true) + key := taggedVals.NomsTupleForTags(types.Format_7_18, []uint64{dtestutils.IdTag}, true) row, ok := table.GetRow(ctx, key.Value(ctx).(types.Tuple), dtestutils.TypedSchema) assert.True(t, ok, "expected id not found") ageVal, _ := row.GetColVal(dtestutils.AgeTag) @@ -447,7 +447,7 @@ func TestDelete(t *testing.T) { for _, expectedid := range test.deletedIds { table, _ := root.GetTable(context.Background(), tableName) taggedVals := row.TaggedValues{dtestutils.IdTag: types.UUID(expectedid)} - key := taggedVals.NomsTupleForTags([]uint64{dtestutils.IdTag}, true) + key := taggedVals.NomsTupleForTags(types.Format_7_18, []uint64{dtestutils.IdTag}, true) _, ok := table.GetRow(ctx, key.Value(ctx).(types.Tuple), dtestutils.TypedSchema) assert.False(t, ok, "row not deleted") } diff --git a/go/cmd/dolt/commands/sqle/sqle_test.go b/go/cmd/dolt/commands/sqle/sqle_test.go index badeb792b5..6aa07a7fdb 100644 --- a/go/cmd/dolt/commands/sqle/sqle_test.go +++ b/go/cmd/dolt/commands/sqle/sqle_test.go @@ -317,7 +317,7 @@ func TestInsert(t *testing.T) { for _, expectedid := range test.expectedIds { table, _ := root.GetTable(context.Background(), tableName) taggedVals := row.TaggedValues{dtestutils.IdTag: types.UUID(expectedid)} - key := taggedVals.NomsTupleForTags([]uint64{dtestutils.IdTag}, true) + key := taggedVals.NomsTupleForTags(types.Format_7_18, []uint64{dtestutils.IdTag}, true) _, ok := table.GetRow(context.Background(), key.Value(context.Background()).(types.Tuple), dtestutils.TypedSchema) assert.True(t, ok, "expected id not found") } @@ -390,7 +390,7 @@ func TestUpdate(t *testing.T) { for i, expectedid := range test.expectedIds { table, _ := root.GetTable(context.Background(), tableName) taggedVals := row.TaggedValues{dtestutils.IdTag: types.UUID(expectedid)} - key := taggedVals.NomsTupleForTags([]uint64{dtestutils.IdTag}, true) + key := taggedVals.NomsTupleForTags(types.Format_7_18, []uint64{dtestutils.IdTag}, true) row, ok := table.GetRow(ctx, key.Value(ctx).(types.Tuple), dtestutils.TypedSchema) assert.True(t, ok, "expected id not found") ageVal, _ := row.GetColVal(dtestutils.AgeTag) @@ -457,7 +457,7 @@ func TestDelete(t *testing.T) { for _, expectedid := range test.deletedIds { table, _ := root.GetTable(context.Background(), tableName) taggedVals := row.TaggedValues{dtestutils.IdTag: types.UUID(expectedid)} - key := taggedVals.NomsTupleForTags([]uint64{dtestutils.IdTag}, true) + key := taggedVals.NomsTupleForTags(types.Format_7_18, []uint64{dtestutils.IdTag}, true) _, ok := table.GetRow(ctx, key.Value(ctx).(types.Tuple), dtestutils.TypedSchema) assert.False(t, ok, "row not deleted") } diff --git a/go/cmd/dolt/commands/tblcmds/import.go b/go/cmd/dolt/commands/tblcmds/import.go index 0b5833f7c6..5997b2ffb1 100644 --- a/go/cmd/dolt/commands/tblcmds/import.go +++ b/go/cmd/dolt/commands/tblcmds/import.go @@ -238,7 +238,7 @@ func executeMove(dEnv *env.DoltEnv, force bool, mvOpts *mvdata.MoveOptions) int r := pipeline.GetTransFailureRow(err) if r != nil { - bdr.AddDetails("Bad Row:" + row.Fmt(context.TODO(), r, mover.Rd.GetSchema())) + bdr.AddDetails("Bad Row:" + row.Fmt(context.TODO(), types.Format_7_18, r, mover.Rd.GetSchema())) } details := pipeline.GetTransFailureDetails(err) diff --git a/go/cmd/dolt/commands/tblcmds/putrow.go b/go/cmd/dolt/commands/tblcmds/putrow.go index 3af201b442..fc3fe676a6 100644 --- a/go/cmd/dolt/commands/tblcmds/putrow.go +++ b/go/cmd/dolt/commands/tblcmds/putrow.go @@ -113,7 +113,7 @@ func PutRow(commandStr string, args []string, dEnv *env.DoltEnv) int { if verr == nil { me := tbl.GetRowData(context.TODO()).Edit() - updated := me.Set(row.NomsMapKey(sch), row.NomsMapValue(sch)).Map(context.TODO()) + updated := me.Set(row.NomsMapKey(types.Format_7_18, sch), row.NomsMapValue(types.Format_7_18, sch)).Map(context.TODO()) tbl = tbl.UpdateRows(context.Background(), updated) root = root.PutTable(context.Background(), dEnv.DoltDB, prArgs.TableName, tbl) diff --git a/go/cmd/dolt/commands/tblcmds/select.go b/go/cmd/dolt/commands/tblcmds/select.go index 3da8dd4d65..108ca170e1 100644 --- a/go/cmd/dolt/commands/tblcmds/select.go +++ b/go/cmd/dolt/commands/tblcmds/select.go @@ -3,6 +3,8 @@ package tblcmds import ( "context" "errors" + "strings" + "github.com/fatih/color" "github.com/liquidata-inc/ld/dolt/go/cmd/dolt/cli" "github.com/liquidata-inc/ld/dolt/go/cmd/dolt/commands" @@ -23,7 +25,6 @@ import ( "github.com/liquidata-inc/ld/dolt/go/libraries/utils/argparser" "github.com/liquidata-inc/ld/dolt/go/libraries/utils/iohelp" "github.com/liquidata-inc/ld/dolt/go/store/types" - "strings" ) const ( @@ -227,7 +228,7 @@ func createPipeline(tbl *doltdb.Table, tblSch schema.Schema, outSch schema.Schem wr := tabular.NewTextTableWriter(iohelp.NopWrCloser(cli.CliOut), outSch) badRowCallback := func(tff *pipeline.TransformRowFailure) (quit bool) { - cli.PrintErrln(color.RedString("error: failed to transform row %s.", row.Fmt(context.TODO(), tff.Row, outSch))) + cli.PrintErrln(color.RedString("error: failed to transform row %s.", row.Fmt(context.TODO(), types.Format_7_18, tff.Row, outSch))) return true } @@ -314,7 +315,7 @@ var noConfLabel = types.String(" ") func CnfTransformer(inSch, outSch schema.Schema, conflicts types.Map) func(inRow row.Row, props pipeline.ReadableMap) (rowData []*pipeline.TransformedRowResult, badRowDetails string) { return func(inRow row.Row, props pipeline.ReadableMap) ([]*pipeline.TransformedRowResult, string) { ctx := context.TODO() - key := inRow.NomsMapKey(inSch) + key := inRow.NomsMapKey(types.Format_7_18, inSch) var err error if conflicts.Has(ctx, key.Value(ctx)) { diff --git a/go/libraries/doltcore/doltdb/key_itr.go b/go/libraries/doltcore/doltdb/key_itr.go index 73073ca100..7c315967bd 100644 --- a/go/libraries/doltcore/doltdb/key_itr.go +++ b/go/libraries/doltcore/doltdb/key_itr.go @@ -37,7 +37,7 @@ func TaggedValueSliceItr(format *types.Format, sch schema.Schema, vals []row.Tag next++ if current < size { - tpl := vals[current].NomsTupleForTags(pkTags, true) + tpl := vals[current].NomsTupleForTags(format, pkTags, true) return tpl.Value(context.TODO()).(types.Tuple), true } diff --git a/go/libraries/doltcore/doltdb/table.go b/go/libraries/doltcore/doltdb/table.go index 0b602a5cf9..6abc328405 100644 --- a/go/libraries/doltcore/doltdb/table.go +++ b/go/libraries/doltcore/doltdb/table.go @@ -187,7 +187,7 @@ func (t *Table) HashOf() hash.Hash { } func (t *Table) GetRowByPKVals(ctx context.Context, pkVals row.TaggedValues, sch schema.Schema) (row.Row, bool) { - pkTuple := pkVals.NomsTupleForTags(sch.GetPKCols().Tags, true) + pkTuple := pkVals.NomsTupleForTags(t.vrw.Format(), sch.GetPKCols().Tags, true) return t.GetRow(ctx, pkTuple.Value(ctx).(types.Tuple), sch) } diff --git a/go/libraries/doltcore/doltdb/table_test.go b/go/libraries/doltcore/doltdb/table_test.go index e3ee18813f..aa52e940d4 100644 --- a/go/libraries/doltcore/doltdb/table_test.go +++ b/go/libraries/doltcore/doltdb/table_test.go @@ -29,7 +29,7 @@ func createTestRowData(vrw types.ValueReadWriter, sch schema.Schema) (types.Map, ed := types.NewMap(context.Background(), vrw).Edit() for _, r := range rows { - ed = ed.Set(r.NomsMapKey(sch), r.NomsMapValue(sch)) + ed = ed.Set(r.NomsMapKey(types.Format_7_18, sch), r.NomsMapValue(types.Format_7_18, sch)) } return ed.Map(context.Background()), rows @@ -71,8 +71,8 @@ func TestTables(t *testing.T) { if !ok { t.Error("Could not find row 0 in table") - } else if !row.AreEqual(readRow0, rows[0], tSchema) { - t.Error(row.Fmt(context.Background(), readRow0, tSchema), "!=", row.Fmt(context.Background(), rows[0], tSchema)) + } else if !row.AreEqual(types.Format_7_18, readRow0, rows[0], tSchema) { + t.Error(row.Fmt(context.Background(), types.Format_7_18, readRow0, tSchema), "!=", row.Fmt(context.Background(), types.Format_7_18, rows[0], tSchema)) } _, ok = tbl.GetRowByPKVals(context.Background(), row.TaggedValues{idTag: types.UUID(badUUID)}, tSchema) @@ -91,8 +91,8 @@ func TestTables(t *testing.T) { } for i, r := range rows { - if !row.AreEqual(r, readRows[i], tSchema) { - t.Error(row.Fmt(context.Background(), readRows[i], tSchema), "!=", row.Fmt(context.Background(), r, tSchema)) + if !row.AreEqual(types.Format_7_18, r, readRows[i], tSchema) { + t.Error(row.Fmt(context.Background(), types.Format_7_18, readRows[i], tSchema), "!=", row.Fmt(context.Background(), types.Format_7_18, r, tSchema)) } } } diff --git a/go/libraries/doltcore/merge/merge.go b/go/libraries/doltcore/merge/merge.go index 54e47bce8b..eadfe78a03 100644 --- a/go/libraries/doltcore/merge/merge.go +++ b/go/libraries/doltcore/merge/merge.go @@ -256,7 +256,7 @@ func rowMerge(ctx context.Context, format *types.Format, sch schema.Schema, r, m return nil, true } - tpl := resultVals.NomsTupleForTags(sch.GetNonPKCols().SortedTags, false) + tpl := resultVals.NomsTupleForTags(format, sch.GetNonPKCols().SortedTags, false) return tpl.Value(ctx), false } diff --git a/go/libraries/doltcore/merge/resolve.go b/go/libraries/doltcore/merge/resolve.go index b40ec44c95..da3ff877a8 100644 --- a/go/libraries/doltcore/merge/resolve.go +++ b/go/libraries/doltcore/merge/resolve.go @@ -27,7 +27,7 @@ func ResolveTable(ctx context.Context, vrw types.ValueReadWriter, tbl *doltdb.Ta tblSchRef := tbl.GetSchemaRef() tblSchVal := tblSchRef.TargetValue(ctx, vrw) - tblSch, err := encoding.UnmarshalNomsValue(ctx, tblSchVal) + tblSch, err := encoding.UnmarshalNomsValue(ctx, vrw.Format(), tblSchVal) if err != nil { return nil, err diff --git a/go/libraries/doltcore/row/fmt.go b/go/libraries/doltcore/row/fmt.go index 8890e03c35..aaf5857864 100644 --- a/go/libraries/doltcore/row/fmt.go +++ b/go/libraries/doltcore/row/fmt.go @@ -8,13 +8,13 @@ import ( "github.com/liquidata-inc/ld/dolt/go/store/types" ) -type RowFormatFunc func(ctx context.Context, r Row, sch schema.Schema) string +type RowFormatFunc func(ctx context.Context, format *types.Format, r Row, sch schema.Schema) string var Fmt = FieldSeparatedFmt(':') var fieldDelim = []byte(" | ") func FieldSeparatedFmt(delim rune) RowFormatFunc { - return func(ctx context.Context, r Row, sch schema.Schema) string { + return func(ctx context.Context, format *types.Format, r Row, sch schema.Schema) string { if r == nil { return "null" } @@ -37,7 +37,7 @@ func FieldSeparatedFmt(delim rune) RowFormatFunc { if ok { buf.Write([]byte(col.Name)) buf.WriteRune(delim) - types.WriteEncodedValue(ctx, types.Format_7_18, buf, val) + types.WriteEncodedValue(ctx, format, buf, val) kvps = append(kvps, buf.String()) } diff --git a/go/libraries/doltcore/row/fmt_test.go b/go/libraries/doltcore/row/fmt_test.go index 354ef7cf09..ca4f6e0d1d 100644 --- a/go/libraries/doltcore/row/fmt_test.go +++ b/go/libraries/doltcore/row/fmt_test.go @@ -3,13 +3,14 @@ package row import ( "context" "testing" + "github.com/liquidata-inc/ld/dolt/go/store/types" ) func TestFmt(t *testing.T) { r := newTestRow() expected := `first:"rick" | last:"astley" | age:53 | address:"123 Fake St" | title:null_value | ` - actual := Fmt(context.Background(), r, sch) + actual := Fmt(context.Background(), types.Format_7_18, r, sch) if expected != actual { t.Errorf("expected: '%s', actual: '%s'", expected, actual) } diff --git a/go/libraries/doltcore/row/noms_row.go b/go/libraries/doltcore/row/noms_row.go index 9973e62c9f..e6e6e446c0 100644 --- a/go/libraries/doltcore/row/noms_row.go +++ b/go/libraries/doltcore/row/noms_row.go @@ -132,10 +132,10 @@ func FromNoms(sch schema.Schema, nomsKey, nomsVal types.Tuple) Row { return fromTaggedVals(sch, key, val) } -func (nr nomsRow) NomsMapKey(sch schema.Schema) types.LesserValuable { - return nr.key.NomsTupleForTags(sch.GetPKCols().Tags, true) +func (nr nomsRow) NomsMapKey(format *types.Format, sch schema.Schema) types.LesserValuable { + return nr.key.NomsTupleForTags(format, sch.GetPKCols().Tags, true) } -func (nr nomsRow) NomsMapValue(sch schema.Schema) types.Valuable { - return nr.value.NomsTupleForTags(sch.GetNonPKCols().SortedTags, false) +func (nr nomsRow) NomsMapValue(format *types.Format, sch schema.Schema) types.Valuable { + return nr.value.NomsTupleForTags(format, sch.GetNonPKCols().SortedTags, false) } diff --git a/go/libraries/doltcore/row/noms_row_test.go b/go/libraries/doltcore/row/noms_row_test.go index d215f9aef9..f460525aeb 100644 --- a/go/libraries/doltcore/row/noms_row_test.go +++ b/go/libraries/doltcore/row/noms_row_test.go @@ -255,15 +255,15 @@ func TestConvToAndFromTuple(t *testing.T) { r := newTestRow() - keyTpl := r.NomsMapKey(sch).(TupleVals) - valTpl := r.NomsMapValue(sch).(TupleVals) + keyTpl := r.NomsMapKey(types.Format_7_18, sch).(TupleVals) + valTpl := r.NomsMapValue(types.Format_7_18, sch).(TupleVals) r2 := FromNoms(sch, keyTpl.Value(ctx).(types.Tuple), valTpl.Value(ctx).(types.Tuple)) - fmt.Println(Fmt(context.Background(), r, sch)) - fmt.Println(Fmt(context.Background(), r2, sch)) + fmt.Println(Fmt(context.Background(), types.Format_7_18, r, sch)) + fmt.Println(Fmt(context.Background(), types.Format_7_18, r2, sch)) - if !AreEqual(r, r2, sch) { + if !AreEqual(types.Format_7_18, r, r2, sch) { t.Error("Failed to convert to a noms tuple, and then convert back to the same row") } } diff --git a/go/libraries/doltcore/row/row.go b/go/libraries/doltcore/row/row.go index b2848b8ce0..1c2acc0731 100644 --- a/go/libraries/doltcore/row/row.go +++ b/go/libraries/doltcore/row/row.go @@ -12,10 +12,10 @@ var ErrRowNotValid = errors.New("invalid row for current schema") type Row interface { // Returns the noms map key for this row, using the schema provided. - NomsMapKey(sch schema.Schema) types.LesserValuable + NomsMapKey(format *types.Format, sch schema.Schema) types.LesserValuable // Returns the noms map value for this row, using the schema provided. - NomsMapValue(sch schema.Schema) types.Valuable + NomsMapValue(format *types.Format, sch schema.Schema) types.Valuable // Iterates over all the columns in the row. Columns that have no value set will not be visited. IterCols(cb func(tag uint64, val types.Value) (stop bool)) bool @@ -107,7 +107,7 @@ func findInvalidCol(r Row, sch schema.Schema) (*schema.Column, schema.ColConstra return badCol, badCnst } -func AreEqual(row1, row2 Row, sch schema.Schema) bool { +func AreEqual(format *types.Format, row1, row2 Row, sch schema.Schema) bool { if row1 == nil && row2 == nil { return true } else if row1 == nil || row2 == nil { @@ -118,7 +118,7 @@ func AreEqual(row1, row2 Row, sch schema.Schema) bool { val1, _ := row1.GetColVal(tag) val2, _ := row2.GetColVal(tag) - if !valutil.NilSafeEqCheck(types.Format_7_18, val1, val2) { + if !valutil.NilSafeEqCheck(format, val1, val2) { return false } } diff --git a/go/libraries/doltcore/row/row_test.go b/go/libraries/doltcore/row/row_test.go index 22ac24ee00..0f817e61b6 100644 --- a/go/libraries/doltcore/row/row_test.go +++ b/go/libraries/doltcore/row/row_test.go @@ -95,6 +95,6 @@ func TestAreEqual(t *testing.T) { updatedRow, err := r.SetColVal(lnColTag, types.String("new"), sch) assert.NoError(t, err) - assert.True(t, AreEqual(r, r, sch)) - assert.False(t, AreEqual(r, updatedRow, sch)) + assert.True(t, AreEqual(types.Format_7_18, r, r, sch)) + assert.False(t, AreEqual(types.Format_7_18, r, updatedRow, sch)) } diff --git a/go/libraries/doltcore/row/tagged_values.go b/go/libraries/doltcore/row/tagged_values.go index 352d0e3d04..6c713786df 100644 --- a/go/libraries/doltcore/row/tagged_values.go +++ b/go/libraries/doltcore/row/tagged_values.go @@ -9,33 +9,36 @@ import ( type TaggedValues map[uint64]types.Value -type TupleVals []types.Value +type TupleVals struct { + vs []types.Value + format *types.Format +} func (tvs TupleVals) Kind() types.NomsKind { return types.TupleKind } func (tvs TupleVals) Value(ctx context.Context) types.Value { - return types.NewTuple(types.Format_7_18, tvs...) + return types.NewTuple(tvs.format, tvs.vs...) } func (tvs TupleVals) Less(f *types.Format, other types.LesserValuable) bool { if other.Kind() == types.TupleKind { if otherTVs, ok := other.(TupleVals); ok { - for i, val := range tvs { - if i == len(otherTVs) { + for i, val := range tvs.vs { + if i == len(otherTVs.vs) { // equal up til the end of other. other is shorter, therefore it is less return false } - otherVal := otherTVs[i] + otherVal := otherTVs.vs[i] - if !val.Equals(types.Format_7_18, otherVal) { + if !val.Equals(f, otherVal) { return val.Less(f, otherVal) } } - return len(tvs) < len(otherTVs) + return len(tvs.vs) < len(otherTVs.vs) } else { panic("not supported") } @@ -44,7 +47,7 @@ func (tvs TupleVals) Less(f *types.Format, other types.LesserValuable) bool { return types.TupleKind < other.Kind() } -func (tt TaggedValues) NomsTupleForTags(tags []uint64, encodeNulls bool) TupleVals { +func (tt TaggedValues) NomsTupleForTags(format *types.Format, tags []uint64, encodeNulls bool) TupleVals { numVals := 0 for _, tag := range tags { val := tt[tag] @@ -70,7 +73,7 @@ func (tt TaggedValues) NomsTupleForTags(tags []uint64, encodeNulls bool) TupleVa } } - return TupleVals(vals) + return TupleVals{vals, format} } func (tt TaggedValues) Iter(cb func(tag uint64, val types.Value) (stop bool)) bool { @@ -135,10 +138,10 @@ func ParseTaggedValues(tpl types.Tuple) TaggedValues { return taggedTuple } -func (tt TaggedValues) String() string { +func (tt TaggedValues) String(format *types.Format) string { str := "{" for k, v := range tt { - str += fmt.Sprintf("\n\t%d: %s", k, types.EncodedValue(context.Background(), types.Format_7_18, v)) + str += fmt.Sprintf("\n\t%d: %s", k, types.EncodedValue(context.Background(), format, v)) } str += "\n}" diff --git a/go/libraries/doltcore/row/tagged_values_test.go b/go/libraries/doltcore/row/tagged_values_test.go index 439df79968..a799c8b73a 100644 --- a/go/libraries/doltcore/row/tagged_values_test.go +++ b/go/libraries/doltcore/row/tagged_values_test.go @@ -80,8 +80,8 @@ func TestTupleValsLess(t *testing.T) { t.Run(test.name, func(t *testing.T) { ctx := context.Background() - lesserTplVals := test.lesserTVs.NomsTupleForTags(test.tags, true) - greaterTplVals := test.greaterTVs.NomsTupleForTags(test.tags, true) + lesserTplVals := test.lesserTVs.NomsTupleForTags(types.Format_7_18, test.tags, true) + greaterTplVals := test.greaterTVs.NomsTupleForTags(types.Format_7_18, test.tags, true) // TODO(binformat) lessLTGreater := lesserTplVals.Less(types.Format_7_18, greaterTplVals) @@ -125,7 +125,7 @@ func TestTaggedTuple_NomsTupleForTags(t *testing.T) { //{map[uint64]types.Value{}, []uint64{}, types.NewTuple()}, } for _, test := range tests { - if got := tt.NomsTupleForTags(test.tags, test.encodeNulls).Value(ctx); !reflect.DeepEqual(got, test.want) { + if got := tt.NomsTupleForTags(types.Format_7_18, test.tags, test.encodeNulls).Value(ctx); !reflect.DeepEqual(got, test.want) { t.Errorf("TaggedValues.NomsTupleForTags() = %v, want %v", types.EncodedValue(ctx, types.Format_7_18, got), types.EncodedValue(ctx, types.Format_7_18, test.want)) } } diff --git a/go/libraries/doltcore/rowconv/row_converter_test.go b/go/libraries/doltcore/rowconv/row_converter_test.go index c9471c3329..1f1317cbdb 100644 --- a/go/libraries/doltcore/rowconv/row_converter_test.go +++ b/go/libraries/doltcore/rowconv/row_converter_test.go @@ -56,8 +56,8 @@ func TestRowConverter(t *testing.T) { 6: types.NullValue, }) - if !row.AreEqual(outData, expected, destSch) { - t.Error("\n", row.Fmt(context.Background(), expected, destSch), "!=\n", row.Fmt(context.Background(), outData, destSch)) + if !row.AreEqual(types.Format_7_18, outData, expected, destSch) { + t.Error("\n", row.Fmt(context.Background(), types.Format_7_18, expected, destSch), "!=\n", row.Fmt(context.Background(), types.Format_7_18, outData, destSch)) } } diff --git a/go/libraries/doltcore/schema/alterschema/addcolumn.go b/go/libraries/doltcore/schema/alterschema/addcolumn.go index ec7c44fa53..64de32cf2e 100644 --- a/go/libraries/doltcore/schema/alterschema/addcolumn.go +++ b/go/libraries/doltcore/schema/alterschema/addcolumn.go @@ -2,6 +2,7 @@ package alterschema import ( "context" + "github.com/liquidata-inc/ld/dolt/go/cmd/dolt/errhand" "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/doltdb" "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/schema" @@ -62,7 +63,7 @@ func updateTableWithNewSchema(ctx context.Context, db *doltdb.DoltDB, tbl *doltd return true } - me.Set(newRow.NomsMapKey(newSchema), newRow.NomsMapValue(newSchema)) + me.Set(newRow.NomsMapKey(vrw.Format(), newSchema), newRow.NomsMapValue(vrw.Format(), newSchema)) return false }) if updateErr != nil { diff --git a/go/libraries/doltcore/sql/sqldelete.go b/go/libraries/doltcore/sql/sqldelete.go index 958a5cabb6..603c8eef64 100644 --- a/go/libraries/doltcore/sql/sqldelete.go +++ b/go/libraries/doltcore/sql/sqldelete.go @@ -4,11 +4,13 @@ import ( "context" "errors" "fmt" + "io" + "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/doltdb" "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/schema" "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/table/typed/noms" "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/table/untyped/resultset" - "io" + "github.com/liquidata-inc/ld/dolt/go/store/types" "vitess.io/vitess/go/vt/sqlparser" ) @@ -79,7 +81,7 @@ func ExecuteDelete(ctx context.Context, db *doltdb.DoltDB, root *doltdb.RootValu } result.NumRowsDeleted++ - me.Remove(r.NomsMapKey(tableSch)) + me.Remove(r.NomsMapKey(types.Format_7_18, tableSch)) } table = table.UpdateRows(ctx, me.Map(ctx)) diff --git a/go/libraries/doltcore/sql/sqldelete_test.go b/go/libraries/doltcore/sql/sqldelete_test.go index 30403cea89..88f0c736af 100644 --- a/go/libraries/doltcore/sql/sqldelete_test.go +++ b/go/libraries/doltcore/sql/sqldelete_test.go @@ -131,7 +131,7 @@ func TestExecuteDelete(t *testing.T) { for _, r := range AllPeopleRows { deletedIdx := FindRowIndex(r, tt.deletedRows) - key := r.NomsMapKey(PeopleTestSchema) + key := r.NomsMapKey(types.Format_7_18, PeopleTestSchema) _, ok := table.GetRow(ctx, key.Value(ctx).(types.Tuple), PeopleTestSchema) if deletedIdx >= 0 { assert.False(t, ok, "Row not deleted: %v", r) diff --git a/go/libraries/doltcore/sql/sqlinsert.go b/go/libraries/doltcore/sql/sqlinsert.go index 335515ab1c..df51cd2161 100644 --- a/go/libraries/doltcore/sql/sqlinsert.go +++ b/go/libraries/doltcore/sql/sqlinsert.go @@ -95,7 +95,7 @@ func ExecuteInsert(ctx context.Context, db *doltdb.DoltDB, root *doltdb.RootValu } } - key := r.NomsMapKey(tableSch).Value(ctx) + key := r.NomsMapKey(types.Format_7_18, tableSch).Value(ctx) rowExists := rowData.Get(ctx, key) != nil // TODO(binformat) @@ -111,7 +111,7 @@ func ExecuteInsert(ctx context.Context, db *doltdb.DoltDB, root *doltdb.RootValu return errInsert("Duplicate primary key: '%v'", getPrimaryKeyString(r, tableSch)) } } - me.Set(key, r.NomsMapValue(tableSch)) + me.Set(key, r.NomsMapValue(types.Format_7_18, tableSch)) // TODO(binformat) insertedPKHashes[key.Hash(types.Format_7_18)] = struct{}{} diff --git a/go/libraries/doltcore/sql/sqlinsert_test.go b/go/libraries/doltcore/sql/sqlinsert_test.go index 7e6be01ad8..9f246a27db 100644 --- a/go/libraries/doltcore/sql/sqlinsert_test.go +++ b/go/libraries/doltcore/sql/sqlinsert_test.go @@ -318,7 +318,7 @@ func TestExecuteInsert(t *testing.T) { assert.True(t, ok) for _, expectedRow := range tt.insertedValues { - foundRow, ok := table.GetRow(ctx, expectedRow.NomsMapKey(PeopleTestSchema).Value(ctx).(types.Tuple), PeopleTestSchema) + foundRow, ok := table.GetRow(ctx, expectedRow.NomsMapKey(types.Format_7_18, PeopleTestSchema).Value(ctx).(types.Tuple), PeopleTestSchema) assert.True(t, ok, "Row not found: %v", expectedRow) opts := cmp.Options{cmp.AllowUnexported(expectedRow), dtestutils.FloatComparer} assert.True(t, cmp.Equal(expectedRow, foundRow, opts), "Rows not equals, found diff %v", cmp.Diff(expectedRow, foundRow, opts)) diff --git a/go/libraries/doltcore/sql/sqlupdate.go b/go/libraries/doltcore/sql/sqlupdate.go index 0ba2cffc91..11ef925941 100644 --- a/go/libraries/doltcore/sql/sqlupdate.go +++ b/go/libraries/doltcore/sql/sqlupdate.go @@ -144,7 +144,7 @@ func ExecuteUpdate(ctx context.Context, db *doltdb.DoltDB, root *doltdb.RootValu return nil, errFmt(ConstraintFailedFmt, col.Name, constraint) } - tvs := r.NomsMapKey(tableSch).(row.TupleVals) + tvs := r.NomsMapKey(types.Format_7_18, tableSch).(row.TupleVals) key := tvs.Value(ctx) if anyColChanged { @@ -153,7 +153,7 @@ func ExecuteUpdate(ctx context.Context, db *doltdb.DoltDB, root *doltdb.RootValu result.NumRowsUnchanged += 1 } - me.Set(key, r.NomsMapValue(tableSch)) + me.Set(key, r.NomsMapValue(types.Format_7_18, tableSch)) } table = table.UpdateRows(ctx, me.Map(ctx)) diff --git a/go/libraries/doltcore/sql/sqlupdate_test.go b/go/libraries/doltcore/sql/sqlupdate_test.go index 117dc17177..370226ad18 100644 --- a/go/libraries/doltcore/sql/sqlupdate_test.go +++ b/go/libraries/doltcore/sql/sqlupdate_test.go @@ -347,7 +347,7 @@ func TestExecuteUpdate(t *testing.T) { expectedRow = tt.updatedRows[updatedIdx] } - foundRow, ok := table.GetRow(ctx, expectedRow.NomsMapKey(PeopleTestSchema).Value(ctx).(types.Tuple), PeopleTestSchema) + foundRow, ok := table.GetRow(ctx, expectedRow.NomsMapKey(types.Format_7_18, PeopleTestSchema).Value(ctx).(types.Tuple), PeopleTestSchema) assert.True(t, ok, "Row not found: %v", expectedRow) opts := cmp.Options{cmp.AllowUnexported(expectedRow), dtestutils.FloatComparer} assert.True(t, cmp.Equal(expectedRow, foundRow, opts), "Rows not equals, found diff %v", cmp.Diff(expectedRow, foundRow, opts)) diff --git a/go/libraries/doltcore/table/errors_test.go b/go/libraries/doltcore/table/errors_test.go index 1ceac8eb10..c42b7d4010 100644 --- a/go/libraries/doltcore/table/errors_test.go +++ b/go/libraries/doltcore/table/errors_test.go @@ -18,7 +18,7 @@ func TestBadRow(t *testing.T) { t.Error("Should be a bad row error") } - if !row.AreEqual(GetBadRowRow(err), emptyRow, sch) { + if !row.AreEqual(types.Format_7_18, GetBadRowRow(err), emptyRow, sch) { t.Error("did not get back expected empty row") } diff --git a/go/libraries/doltcore/table/inmem_table.go b/go/libraries/doltcore/table/inmem_table.go index d2c814a455..81de649146 100644 --- a/go/libraries/doltcore/table/inmem_table.go +++ b/go/libraries/doltcore/table/inmem_table.go @@ -49,8 +49,7 @@ func (imt *InMemTable) AppendRow(r row.Row) error { sort.Slice(imt.rows, func(i, j int) bool { iRow := imt.rows[i] jRow := imt.rows[j] - // TODO(binformat) - return iRow.NomsMapKey(imt.sch).Less(types.Format_7_18, jRow.NomsMapKey(imt.sch)) + return iRow.NomsMapKey(types.Format_7_18, imt.sch).Less(types.Format_7_18, jRow.NomsMapKey(types.Format_7_18, imt.sch)) }) return nil diff --git a/go/libraries/doltcore/table/inmem_table_test.go b/go/libraries/doltcore/table/inmem_table_test.go index a5f3cb22f9..8421e95bef 100644 --- a/go/libraries/doltcore/table/inmem_table_test.go +++ b/go/libraries/doltcore/table/inmem_table_test.go @@ -75,7 +75,7 @@ func TestInMemTable(t *testing.T) { if err != nil { t.Error("Unexpected read error") - } else if !row.AreEqual(expectedRow, actualRow, rowSch) { + } else if !row.AreEqual(types.Format_7_18, expectedRow, actualRow, rowSch) { t.Error("Unexpected row value") } } @@ -117,8 +117,8 @@ func TestPipeRows(t *testing.T) { t.Fatal("Couldn't Get row.") } - if !row.AreEqual(r1, r2, rowSch) { - t.Error("Rows should be the same.", row.Fmt(context.Background(), r1, rowSch), "!=", row.Fmt(context.Background(), r2, rowSch)) + if !row.AreEqual(types.Format_7_18, r1, r2, rowSch) { + t.Error("Rows should be the same.", row.Fmt(context.Background(), types.Format_7_18, r1, rowSch), "!=", row.Fmt(context.Background(), types.Format_7_18, r2, rowSch)) } } } @@ -148,8 +148,8 @@ func TestReadAllRows(t *testing.T) { } for i := 0; i < len(rows); i++ { - if !row.AreEqual(rows[i], results[i], rowSch) { - t.Error(row.Fmt(context.Background(), rows[i], rowSch), "!=", row.Fmt(context.Background(), results[i], rowSch)) + if !row.AreEqual(types.Format_7_18, rows[i], results[i], rowSch) { + t.Error(row.Fmt(context.Background(), types.Format_7_18, rows[i], rowSch), "!=", row.Fmt(context.Background(), types.Format_7_18, results[i], rowSch)) } } } diff --git a/go/libraries/doltcore/table/pipeline/errors_test.go b/go/libraries/doltcore/table/pipeline/errors_test.go index 6d97ec87b6..60290d6c1c 100644 --- a/go/libraries/doltcore/table/pipeline/errors_test.go +++ b/go/libraries/doltcore/table/pipeline/errors_test.go @@ -3,6 +3,7 @@ package pipeline import ( "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/row" "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/table/untyped" + "github.com/liquidata-inc/ld/dolt/go/store/types" "testing" ) @@ -24,7 +25,7 @@ func TestTransformRowFailure(t *testing.T) { fr := GetTransFailureRow(err) - if !row.AreEqual(r, fr, sch) { + if !row.AreEqual(types.Format_7_18, r, fr, sch) { t.Error("unexpected row") } diff --git a/go/libraries/doltcore/table/typed/json/table_marshaling.go b/go/libraries/doltcore/table/typed/json/table_marshaling.go index d3f49684c7..a6fa560dd7 100644 --- a/go/libraries/doltcore/table/typed/json/table_marshaling.go +++ b/go/libraries/doltcore/table/typed/json/table_marshaling.go @@ -72,7 +72,7 @@ func TableFromJSON(ctx context.Context, fp string, vrw types.ValueReadWriter, sc var rowMap types.Map me := types.NewMap(ctx, vrw).Edit() for _, row := range tblRows { - me = me.Set(row.NomsMapKey(sch), row.NomsMapValue(sch)) + me = me.Set(row.NomsMapKey(vrw.Format(), sch), row.NomsMapValue(vrw.Format(), sch)) } rowMap = me.Map(ctx) diff --git a/go/libraries/doltcore/table/typed/noms/noms_map_creator.go b/go/libraries/doltcore/table/typed/noms/noms_map_creator.go index 9381a478e4..8255f3f20b 100644 --- a/go/libraries/doltcore/table/typed/noms/noms_map_creator.go +++ b/go/libraries/doltcore/table/typed/noms/noms_map_creator.go @@ -52,10 +52,9 @@ func (nmc *NomsMapCreator) WriteRow(ctx context.Context, r row.Row) error { } }() - pk := r.NomsMapKey(nmc.sch) - fieldVals := r.NomsMapValue(nmc.sch) - // TODO(binformat) - if nmc.lastPK == nil || nmc.lastPK.Less(types.Format_7_18, pk) { + pk := r.NomsMapKey(nmc.vrw.Format(), nmc.sch) + fieldVals := r.NomsMapValue(nmc.vrw.Format(), nmc.sch) + if nmc.lastPK == nil || nmc.lastPK.Less(nmc.vrw.Format(), pk) { pkVal := pk.Value(ctx) nmc.kvsChan <- pkVal diff --git a/go/libraries/doltcore/table/typed/noms/noms_map_updater.go b/go/libraries/doltcore/table/typed/noms/noms_map_updater.go index 3323986fbd..6954a863ee 100644 --- a/go/libraries/doltcore/table/typed/noms/noms_map_updater.go +++ b/go/libraries/doltcore/table/typed/noms/noms_map_updater.go @@ -81,15 +81,15 @@ func (nmu *NomsMapUpdater) WriteRow(ctx context.Context, r row.Row) error { } }() - pk := r.NomsMapKey(nmu.sch) - fieldVals := r.NomsMapValue(nmu.sch) + pk := r.NomsMapKey(nmu.vrw.Format(), nmu.sch) + fieldVals := r.NomsMapValue(nmu.vrw.Format(), nmu.sch) nmu.acc.AddEdit(pk, fieldVals) nmu.count++ if nmu.count%maxEdits == 0 { nmu.mapChan <- nmu.acc.FinishedEditing() - nmu.acc = types.CreateEditAccForMapEdits(types.Format_7_18) + nmu.acc = types.CreateEditAccForMapEdits(nmu.vrw.Format()) } }() diff --git a/go/libraries/doltcore/table/typed/noms/read_write_test.go b/go/libraries/doltcore/table/typed/noms/read_write_test.go index 8bcc74b6f8..5e41a915c6 100644 --- a/go/libraries/doltcore/table/typed/noms/read_write_test.go +++ b/go/libraries/doltcore/table/typed/noms/read_write_test.go @@ -145,8 +145,8 @@ func testReadAndCompare(t *testing.T, initialMapVal *types.Map, expectedRows []r } for i := 0; i < len(expectedRows); i++ { - if !row.AreEqual(actualRows[i], expectedRows[i], sch) { - t.Error(row.Fmt(context.Background(), actualRows[i], sch), "!=", row.Fmt(context.Background(), expectedRows[i], sch)) + if !row.AreEqual(types.Format_7_18, actualRows[i], expectedRows[i], sch) { + t.Error(row.Fmt(context.Background(), types.Format_7_18, actualRows[i], sch), "!=", row.Fmt(context.Background(), types.Format_7_18, expectedRows[i], sch)) } } } diff --git a/go/libraries/doltcore/table/untyped/csv/reader_test.go b/go/libraries/doltcore/table/untyped/csv/reader_test.go index ff2314e298..8e8a880d31 100644 --- a/go/libraries/doltcore/table/untyped/csv/reader_test.go +++ b/go/libraries/doltcore/table/untyped/csv/reader_test.go @@ -6,6 +6,7 @@ import ( "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/table" "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/table/untyped" "github.com/liquidata-inc/ld/dolt/go/libraries/utils/filesys" + "github.com/liquidata-inc/ld/dolt/go/store/types" "io" "strings" "testing" @@ -93,8 +94,8 @@ func TestReader(t *testing.T) { } else { for i, r := range rows { expectedRow := test.expectedRows[i] - if !row.AreEqual(r, expectedRow, sch) { - t.Error(row.Fmt(context.Background(), r, sch), "!=", row.Fmt(context.Background(), expectedRow, sch)) + if !row.AreEqual(types.Format_7_18, r, expectedRow, sch) { + t.Error(row.Fmt(context.Background(), types.Format_7_18, r, sch), "!=", row.Fmt(context.Background(), types.Format_7_18, expectedRow, sch)) } } } diff --git a/go/libraries/doltcore/table/untyped/fwt/reader_test.go b/go/libraries/doltcore/table/untyped/fwt/reader_test.go index 9d492a5249..ad003cb4cd 100644 --- a/go/libraries/doltcore/table/untyped/fwt/reader_test.go +++ b/go/libraries/doltcore/table/untyped/fwt/reader_test.go @@ -6,6 +6,7 @@ import ( "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/table" "github.com/liquidata-inc/ld/dolt/go/libraries/doltcore/table/untyped" "github.com/liquidata-inc/ld/dolt/go/libraries/utils/filesys" + "github.com/liquidata-inc/ld/dolt/go/store/types" "io" "strings" "testing" @@ -80,8 +81,8 @@ func TestReader(t *testing.T) { } else { for i, r := range rows { expectedRow := test.expectedRows[i] - if !row.AreEqual(r, expectedRow, sch) { - t.Error(row.Fmt(context.Background(), r, sch), "!=", row.Fmt(context.Background(), expectedRow, sch)) + if !row.AreEqual(types.Format_7_18, r, expectedRow, sch) { + t.Error(row.Fmt(context.Background(), types.Format_7_18, r, sch), "!=", row.Fmt(context.Background(), types.Format_7_18, expectedRow, sch)) } } }