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

dolt support for MULTILINESTRING #4505

Merged
merged 31 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
facd840
Merge branch 'main' into james/multilinestring
Oct 7, 2022
3b4255b
Merge branch 'james/multipoint' into james/multilinestring
Oct 7, 2022
9c80624
starting to add support for multilinestring
Oct 7, 2022
ef8bc02
fixing constants
Oct 7, 2022
54c5694
adding multilinestring to maps
Oct 7, 2022
a50d158
Merge branch 'james/multipoint' into james/multilinestring
Oct 7, 2022
9409ee6
Merge branch 'james/multipoint' into james/multilinestring
Oct 7, 2022
1bec8ff
Merge branch 'james/multipoint' into james/multilinestring
Oct 7, 2022
de8229c
is this the right copyright header
Oct 7, 2022
da5b02a
Merge branch 'james/multipoint' into james/multilinestring
Oct 7, 2022
5558268
Merge branch 'james/multipoint' into james/multilinestring
Oct 10, 2022
ee58f7a
Merge branch 'main' into james/multilinestring
Oct 11, 2022
c7f7c69
adding type info
Oct 11, 2022
17bbdf5
bump
Oct 11, 2022
94463f0
merg with main
Oct 11, 2022
961e0c4
adding to tuples and validation
Oct 11, 2022
4d9b808
prolly fields
Oct 11, 2022
846c321
row fmt
Oct 11, 2022
aacedd1
updating type identifiers
Oct 11, 2022
8a4652d
updating type info conversions
Oct 11, 2022
1812dc8
aaaaaaaaaaaaaaaaaaaaaaaaaaa
Oct 11, 2022
8415fb9
fixing type info
Oct 11, 2022
ffd2c91
fixing type info copy pasta
Oct 11, 2022
05a1a2d
adding type info test
Oct 11, 2022
4f130a4
merge with main
Oct 12, 2022
669728b
small fix
Oct 12, 2022
0e430a1
bump
Oct 12, 2022
51fce98
another conversion
Oct 12, 2022
7337ef0
all conversions
Oct 12, 2022
8590965
more conversions
Oct 12, 2022
2891a01
Merge branch 'main' into james/multilinestring
Oct 13, 2022
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
2 changes: 1 addition & 1 deletion go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ require (
require (
github.com/aliyun/aliyun-oss-go-sdk v2.2.5+incompatible
github.com/cenkalti/backoff/v4 v4.1.3
github.com/dolthub/go-mysql-server v0.12.1-0.20221012024828-31c80677e515
github.com/dolthub/go-mysql-server v0.12.1-0.20221012045247-2eb37b2d80e0
github.com/google/flatbuffers v2.0.6+incompatible
github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6
github.com/mitchellh/go-ps v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ github.com/dolthub/flatbuffers v1.13.0-dh.1 h1:OWJdaPep22N52O/0xsUevxJ6Qfw1M2txC
github.com/dolthub/flatbuffers v1.13.0-dh.1/go.mod h1:CorYGaDmXjHz1Z7i50PYXG1Ricn31GcA2wNOTFIQAKE=
github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
github.com/dolthub/go-mysql-server v0.12.1-0.20221012024828-31c80677e515 h1:aJUfFDEnvlNEcyHQzCGfHtG+VBIRvX8blEcL2QlKSLo=
github.com/dolthub/go-mysql-server v0.12.1-0.20221012024828-31c80677e515/go.mod h1:9Q9FhWO82GrV4he13V2ZuDE0T/eDZbPVMOWLcZluOvg=
github.com/dolthub/go-mysql-server v0.12.1-0.20221012045247-2eb37b2d80e0 h1:lmmFbgh51CHtwM+skbDuzN3j7fdgkLsn0omS1C0TZxA=
github.com/dolthub/go-mysql-server v0.12.1-0.20221012045247-2eb37b2d80e0/go.mod h1:9Q9FhWO82GrV4he13V2ZuDE0T/eDZbPVMOWLcZluOvg=
github.com/dolthub/ishell v0.0.0-20220112232610-14e753f0f371 h1:oyPHJlzumKta1vnOQqUnfdz+pk3EmnHS3Nd0cCT0I2g=
github.com/dolthub/ishell v0.0.0-20220112232610-14e753f0f371/go.mod h1:dhGBqcCEfK5kuFmeO5+WOx3hqc1k3M29c1oS/R7N4ms=
github.com/dolthub/jsonpath v0.0.0-20210609232853-d49537a30474 h1:xTrR+l5l+1Lfq0NvhiEsctylXinUMFhhsqaEcl414p8=
Expand Down
4 changes: 4 additions & 0 deletions go/libraries/doltcore/migrate/tuples.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ func translateGeometryField(value types.Value, idx int, b *val.TupleBuilder) {
p := types.ConvertTypesMultiPointToSQLMultiPoint(value.(types.MultiPoint))
b.PutGeometry(idx, p.Serialize())

case types.MultiLineStringKind:
l := types.ConvertTypesMultiLineStringToSQLMultiLineString(value.(types.MultiLineString))
b.PutGeometry(idx, l.Serialize())

default:
panic(fmt.Sprintf("unexpected NomsKind for geometry (%d)", nk))
}
Expand Down
3 changes: 2 additions & 1 deletion go/libraries/doltcore/migrate/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,9 @@ func nomsKindsFromQueryTypes(qt query.Type) []types.NomsKind {
types.GeometryKind,
types.PointKind,
types.LineStringKind,
types.MultiPointKind,
types.PolygonKind,
types.MultiPointKind,
types.MultiLineStringKind,
}

case query.Type_JSON:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/bit.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ func bitTypeConverter(ctx context.Context, src *bitType, destTi TypeInfo) (tc Ty
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/blobstring.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ func blobStringTypeConverter(ctx context.Context, src *blobStringType, destTi Ty
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/bool.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ func boolTypeConverter(ctx context.Context, src *boolType, destTi TypeInfo) (tc
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/datetime.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ func datetimeTypeConverter(ctx context.Context, src *datetimeType, destTi TypeIn
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ func decimalTypeConverter(ctx context.Context, src *decimalType, destTi TypeInfo
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ func enumTypeConverter(ctx context.Context, src *enumType, destTi TypeInfo) (tc
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/float.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ func floatTypeConverter(ctx context.Context, src *floatType, destTi TypeInfo) (t
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
12 changes: 12 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/geometry.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func (ti *geometryType) ConvertNomsValueToValue(v types.Value) (interface{}, err
return types.ConvertTypesPolygonToSQLPolygon(val), nil
case types.MultiPoint:
return types.ConvertTypesMultiPointToSQLMultiPoint(val), nil
case types.MultiLineString:
return types.ConvertTypesMultiLineStringToSQLMultiLineString(val), nil
default:
return nil, fmt.Errorf(`"%v" cannot convert NomsKind "%v" to a value`, ti.String(), v.Kind())
}
Expand Down Expand Up @@ -81,6 +83,10 @@ func (ti *geometryType) ReadFrom(nbf *types.NomsBinFormat, reader types.CodecRea
if val, err = reader.ReadMultiPoint(); err != nil {
return nil, err
}
case types.MultiLineStringKind:
if val, err = reader.ReadMultiLineString(); err != nil {
return nil, err
}
case types.GeometryKind:
// Note: GeometryKind is no longer written
// included here for backward compatibility
Expand Down Expand Up @@ -140,6 +146,8 @@ func (ti *geometryType) FormatValue(v types.Value) (*string, error) {
return PolygonType.FormatValue(val)
case types.MultiPoint:
return MultiPointType.FormatValue(val)
case types.MultiLineString:
return MultiLineStringType.FormatValue(val)
case types.Geometry:
switch inner := val.Inner.(type) {
case types.Point:
Expand All @@ -150,6 +158,8 @@ func (ti *geometryType) FormatValue(v types.Value) (*string, error) {
return PolygonType.FormatValue(inner)
case types.MultiPoint:
return MultiPointType.FormatValue(inner)
case types.MultiLineString:
return MultiLineStringType.FormatValue(inner)
default:
return nil, fmt.Errorf(`"%v" has unexpectedly encountered a value of type "%T" from embedded type`, ti.String(), v.Kind())
}
Expand Down Expand Up @@ -235,6 +245,8 @@ func geometryTypeConverter(ctx context.Context, src *geometryType, destTi TypeIn
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/inlineblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ func inlineBlobTypeConverter(ctx context.Context, src *inlineBlobType, destTi Ty
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/int.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ func intTypeConverter(ctx context.Context, src *intType, destTi TypeInfo) (tc Ty
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ func jsonTypeConverter(ctx context.Context, src *jsonType, destTi TypeInfo) (tc
return wrapIsValid(dest.IsValid, src, dest)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
2 changes: 2 additions & 0 deletions go/libraries/doltcore/schema/typeinfo/linestring.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ func linestringTypeConverter(ctx context.Context, src *linestringType, destTi Ty
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *linestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multilinestringType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *multipointType:
return wrapConvertValueToNomsValue(dest.ConvertValueToNomsValue)
case *pointType:
Expand Down
Loading