diff --git a/go/cmd/dolt/commands/tblcmds/import.go b/go/cmd/dolt/commands/tblcmds/import.go index f976af09ae..5ff53a75c4 100644 --- a/go/cmd/dolt/commands/tblcmds/import.go +++ b/go/cmd/dolt/commands/tblcmds/import.go @@ -775,7 +775,7 @@ func NameAndTypeTransform(row sql.Row, rowOperationSchema sql.PrimaryKeySchema, // For non string types we want empty strings to be converted to nils. String types should be allowed to take on // an empty string value switch col.Type.(type) { - case types2.StringType: + case sql.StringType: default: row[i] = emptyStringToNil(row[i]) } diff --git a/go/libraries/doltcore/merge/merge_rows.go b/go/libraries/doltcore/merge/merge_rows.go index 6183ba9fbb..32fbc615d7 100644 --- a/go/libraries/doltcore/merge/merge_rows.go +++ b/go/libraries/doltcore/merge/merge_rows.go @@ -20,8 +20,6 @@ import ( "fmt" "strings" - types2 "github.com/dolthub/go-mysql-server/sql/types" - "github.com/dolthub/dolt/go/libraries/doltcore/conflict" "github.com/dolthub/dolt/go/libraries/doltcore/diff" "github.com/dolthub/dolt/go/libraries/doltcore/doltdb" @@ -32,6 +30,7 @@ import ( "github.com/dolthub/dolt/go/store/hash" "github.com/dolthub/dolt/go/store/prolly/tree" "github.com/dolthub/dolt/go/store/types" + "github.com/dolthub/go-mysql-server/sql" ) type MergeOpts struct { @@ -408,8 +407,8 @@ func validateTupleFields(existingSch schema.Schema, targetSch schema.Schema) (bo // If the collation was changed, bail. // Different collations will affect the ordering of any secondary indexes using this column. - existingStr, ok1 := existingSch.GetNonPKCols().GetByIndex(i).TypeInfo.ToSqlType().(types2.StringType) - targetStr, ok2 := targetSch.GetNonPKCols().GetByIndex(i).TypeInfo.ToSqlType().(types2.StringType) + existingStr, ok1 := existingSch.GetNonPKCols().GetByIndex(i).TypeInfo.ToSqlType().(sql.StringType) + targetStr, ok2 := targetSch.GetNonPKCols().GetByIndex(i).TypeInfo.ToSqlType().(sql.StringType) if ok1 && ok2 && !existingStr.Collation().Equals(targetStr.Collation()) { return false, nil diff --git a/go/libraries/doltcore/migrate/transform.go b/go/libraries/doltcore/migrate/transform.go index c3ebefaa5d..6d19e53cd5 100644 --- a/go/libraries/doltcore/migrate/transform.go +++ b/go/libraries/doltcore/migrate/transform.go @@ -502,7 +502,7 @@ func migrateSchema(ctx context.Context, tableName string, existing schema.Schema // String types are sorted using a binary collation in __LD_1__ // force-set collation to utf8mb4_0900_bin to match the order for i, c := range cols { - st, ok := c.TypeInfo.ToSqlType().(types2.StringType) + st, ok := c.TypeInfo.ToSqlType().(sql.StringType) if !ok { continue } diff --git a/go/libraries/doltcore/schema/schema_impl.go b/go/libraries/doltcore/schema/schema_impl.go index fb2f8dbc6a..5f8ddc7c8f 100644 --- a/go/libraries/doltcore/schema/schema_impl.go +++ b/go/libraries/doltcore/schema/schema_impl.go @@ -21,7 +21,6 @@ import ( "strings" "github.com/dolthub/go-mysql-server/sql" - types2 "github.com/dolthub/go-mysql-server/sql/types" "github.com/dolthub/vitess/go/vt/proto/query" "github.com/dolthub/dolt/go/store/types" @@ -439,7 +438,7 @@ func (si *schemaImpl) GetKeyDescriptor() val.TupleDesc { tt = append(tt, t) if queryType == query.Type_CHAR || queryType == query.Type_VARCHAR || queryType == query.Type_TEXT { useCollations = true - collations = append(collations, sqlType.(types2.StringType).Collation()) + collations = append(collations, sqlType.(sql.StringType).Collation()) } else { collations = append(collations, sql.Collation_Unspecified) } @@ -476,7 +475,7 @@ func (si *schemaImpl) GetValueDescriptor() val.TupleDesc { }) if queryType == query.Type_CHAR || queryType == query.Type_VARCHAR { useCollations = true - collations = append(collations, sqlType.(types2.StringType).Collation()) + collations = append(collations, sqlType.(sql.StringType).Collation()) } else { collations = append(collations, sql.Collation_Unspecified) } diff --git a/go/libraries/doltcore/schema/typeinfo/blobstring.go b/go/libraries/doltcore/schema/typeinfo/blobstring.go index ec95eee1e7..eb35f093de 100644 --- a/go/libraries/doltcore/schema/typeinfo/blobstring.go +++ b/go/libraries/doltcore/schema/typeinfo/blobstring.go @@ -39,7 +39,7 @@ const ( // repositories that were made before the introduction of blobStringType will still use varStringType for existing // columns. type blobStringType struct { - sqlStringType types2.StringType + sqlStringType sql.StringType } var _ TypeInfo = (*blobStringType)(nil) @@ -192,7 +192,7 @@ func (ti *blobStringType) NomsKind() types.NomsKind { // Promote implements TypeInfo interface. func (ti *blobStringType) Promote() TypeInfo { - return &blobStringType{ti.sqlStringType.Promote().(types2.StringType)} + return &blobStringType{ti.sqlStringType.Promote().(sql.StringType)} } // String implements TypeInfo interface. diff --git a/go/libraries/doltcore/schema/typeinfo/inlineblob.go b/go/libraries/doltcore/schema/typeinfo/inlineblob.go index 0b5a1443c2..c3f8a0e2b8 100644 --- a/go/libraries/doltcore/schema/typeinfo/inlineblob.go +++ b/go/libraries/doltcore/schema/typeinfo/inlineblob.go @@ -37,7 +37,7 @@ const ( // inlineBlobType handles BINARY and VARBINARY. BLOB types are handled by varBinaryType. type inlineBlobType struct { - sqlBinaryType types2.StringType + sqlBinaryType sql.StringType } var _ TypeInfo = (*inlineBlobType)(nil) @@ -58,7 +58,7 @@ func CreateInlineBlobTypeFromParams(params map[string]string) (TypeInfo, error) return nil, fmt.Errorf(`create inlineblob type info is missing param "%v"`, inlineBlobTypeParam_Length) } if sqlStr, ok := params[inlineBlobTypeParam_SQL]; ok { - var sqlType types2.StringType + var sqlType sql.StringType switch sqlStr { case inlineBlobTypeParam_SQL_Binary: sqlType, err = types2.CreateBinary(sqltypes.Binary, length) @@ -187,7 +187,7 @@ func (ti *inlineBlobType) NomsKind() types.NomsKind { // Promote implements TypeInfo interface. func (ti *inlineBlobType) Promote() TypeInfo { - return &inlineBlobType{ti.sqlBinaryType.Promote().(types2.StringType)} + return &inlineBlobType{ti.sqlBinaryType.Promote().(sql.StringType)} } // String implements TypeInfo interface. diff --git a/go/libraries/doltcore/schema/typeinfo/typeinfo.go b/go/libraries/doltcore/schema/typeinfo/typeinfo.go index 42dc2d46a3..a3cee706dd 100644 --- a/go/libraries/doltcore/schema/typeinfo/typeinfo.go +++ b/go/libraries/doltcore/schema/typeinfo/typeinfo.go @@ -200,37 +200,37 @@ func FromSqlType(sqlType sql.Type) (TypeInfo, error) { } return &decimalType{decimalSQLType}, nil case sqltypes.Text: - stringType, ok := sqlType.(types2.StringType) + stringType, ok := sqlType.(sql.StringType) if !ok { return nil, fmt.Errorf(`expected "StringType" from SQL basetype "Text"`) } return &blobStringType{stringType}, nil case sqltypes.Blob: - stringType, ok := sqlType.(types2.StringType) + stringType, ok := sqlType.(sql.StringType) if !ok { return nil, fmt.Errorf(`expected "StringType" from SQL basetype "Blob"`) } return &varBinaryType{stringType}, nil case sqltypes.VarChar: - stringType, ok := sqlType.(types2.StringType) + stringType, ok := sqlType.(sql.StringType) if !ok { return nil, fmt.Errorf(`expected "StringType" from SQL basetype "VarChar"`) } return &varStringType{stringType}, nil case sqltypes.VarBinary: - stringType, ok := sqlType.(types2.StringType) + stringType, ok := sqlType.(sql.StringType) if !ok { return nil, fmt.Errorf(`expected "StringType" from SQL basetype "VarBinary"`) } return &inlineBlobType{stringType}, nil case sqltypes.Char: - stringType, ok := sqlType.(types2.StringType) + stringType, ok := sqlType.(sql.StringType) if !ok { return nil, fmt.Errorf(`expected "StringType" from SQL basetype "Char"`) } return &varStringType{stringType}, nil case sqltypes.Binary: - stringType, ok := sqlType.(types2.StringType) + stringType, ok := sqlType.(sql.StringType) if !ok { return nil, fmt.Errorf(`expected "StringType" from SQL basetype "Binary"`) } diff --git a/go/libraries/doltcore/schema/typeinfo/uuid.go b/go/libraries/doltcore/schema/typeinfo/uuid.go index cdf2234727..d67100040e 100644 --- a/go/libraries/doltcore/schema/typeinfo/uuid.go +++ b/go/libraries/doltcore/schema/typeinfo/uuid.go @@ -27,7 +27,7 @@ import ( ) type uuidType struct { - sqlCharType types2.StringType + sqlCharType sql.StringType } var _ TypeInfo = (*uuidType)(nil) diff --git a/go/libraries/doltcore/schema/typeinfo/varbinary.go b/go/libraries/doltcore/schema/typeinfo/varbinary.go index 7b19bd8645..f99a3996fd 100644 --- a/go/libraries/doltcore/schema/typeinfo/varbinary.go +++ b/go/libraries/doltcore/schema/typeinfo/varbinary.go @@ -41,7 +41,7 @@ const ( // // This type handles the BLOB types. BINARY and VARBINARY are handled by inlineBlobType. type varBinaryType struct { - sqlBinaryType types2.StringType + sqlBinaryType sql.StringType } var _ TypeInfo = (*varBinaryType)(nil) @@ -174,7 +174,7 @@ func (ti *varBinaryType) NomsKind() types.NomsKind { // Promote implements TypeInfo interface. func (ti *varBinaryType) Promote() TypeInfo { - return &varBinaryType{ti.sqlBinaryType.Promote().(types2.StringType)} + return &varBinaryType{ti.sqlBinaryType.Promote().(sql.StringType)} } // String implements TypeInfo interface. diff --git a/go/libraries/doltcore/schema/typeinfo/varstring.go b/go/libraries/doltcore/schema/typeinfo/varstring.go index 49a612bd7e..681d315c34 100644 --- a/go/libraries/doltcore/schema/typeinfo/varstring.go +++ b/go/libraries/doltcore/schema/typeinfo/varstring.go @@ -43,7 +43,7 @@ const ( // legacy repositories will run into issues if they attempt to insert very large strings. Any and all new repositories // must use blobStringType for all TEXT types to ensure proper behavior. type varStringType struct { - sqlStringType types2.StringType + sqlStringType sql.StringType } var _ TypeInfo = (*varStringType)(nil) @@ -74,7 +74,7 @@ func CreateVarStringTypeFromParams(params map[string]string) (TypeInfo, error) { return nil, fmt.Errorf(`create varstring type info is missing param "%v"`, varStringTypeParam_Length) } if sqlStr, ok := params[varStringTypeParam_SQL]; ok { - var sqlType types2.StringType + var sqlType sql.StringType switch sqlStr { case varStringTypeParam_SQL_Char: sqlType, err = types2.CreateString(sqltypes.Char, length, collation) @@ -226,7 +226,7 @@ func (ti *varStringType) NomsKind() types.NomsKind { // Promote implements TypeInfo interface. func (ti *varStringType) Promote() TypeInfo { - return &varStringType{ti.sqlStringType.Promote().(types2.StringType)} + return &varStringType{ti.sqlStringType.Promote().(sql.StringType)} } // String implements TypeInfo interface. diff --git a/go/libraries/doltcore/sqle/dfunctions/dolt_merge_base.go b/go/libraries/doltcore/sqle/dfunctions/dolt_merge_base.go index eef80410aa..38cac2809a 100644 --- a/go/libraries/doltcore/sqle/dfunctions/dolt_merge_base.go +++ b/go/libraries/doltcore/sqle/dfunctions/dolt_merge_base.go @@ -39,10 +39,10 @@ func NewMergeBase(left, right sql.Expression) sql.Expression { // Eval implements the sql.Expression interface. func (d MergeBase) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) { - if _, ok := d.Left.Type().(types.StringType); !ok { + if _, ok := d.Left.Type().(sql.StringType); !ok { return nil, sql.ErrInvalidType.New(d.Left.Type()) } - if _, ok := d.Right.Type().(types.StringType); !ok { + if _, ok := d.Right.Type().(sql.StringType); !ok { return nil, sql.ErrInvalidType.New(d.Right.Type()) } diff --git a/go/libraries/doltcore/sqle/tables.go b/go/libraries/doltcore/sqle/tables.go index 6816dd3f5b..25399f4431 100644 --- a/go/libraries/doltcore/sqle/tables.go +++ b/go/libraries/doltcore/sqle/tables.go @@ -408,7 +408,7 @@ func (t *DoltTable) DataLength(ctx *sql.Context) (uint64, error) { switch n := col.Type.(type) { case sql.NumberType: numBytesPerRow += 8 - case types2.StringType: + case sql.StringType: numBytesPerRow += uint64(n.MaxByteLength()) case types2.BitType: numBytesPerRow += 1