-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add geospatial interface in src common change type define and add segcore support add storage & chunkdata support feature: go package storage & proxy & typeutil support geospatial type in internal and typeutil in pkg Signed-off-by: tasty-gumi <1021989072@qq.com> add geospatial interface in src common change type define and add segcore support change: use wkb only in core Signed-off-by: tasty-gumi <1021989072@qq.com> fix:the geospatial only use std::string as FieldDataImpl template paramters && add geospatial data generation && pass chunk ,growing , sealed test fix : merge confilcts after rebase ,test nullable not pass due to upstream feat:basic GIS Function expr and visitor impl and GIS proto support && add:storage test of geo data Signed-off-by: tasty-gumi <1021989072@qq.com> feat:add proxy validate (pass httpserver test) && plan parser of geospatialfunction fix:sealedseg && go tidy fix:go mod feat:can produce wkt result for pymilvus client feat: add parser and query operator for geos filed && print geos binlog as wkt fix:fielddataimpl interface Signed-off-by: tasty-gumi <1021989072@qq.com> fix: some format of code && segmentfault debug for rebase Signed-off-by: tasty-gumi <1021989072@qq.com> add: import util test for parquet and mix compaction test Signed-off-by: tasty-gumi <1021989072@qq.com> fix: delete useless file and fix error for rebase Signed-off-by: tasty-gumi <1021989072@qq.com> fix: git rebase for custom function feat Signed-off-by: tasty-gumi <1021989072@qq.com> fix:rename geospatial field && update proto && rewrite Geometry class with smart pointer Signed-off-by: tasty-gumi <1021989072@qq.com> add:last commit miss add files Signed-off-by: tasty-gumi <1021989072@qq.com> fix: geospatial name replace in test files && fix geomertry and parser fix:remove some file change for dev Signed-off-by: tasty-gumi <1021989072@qq.com> fix:remove size in if && add destory in ~Geometry() Signed-off-by: tasty-gumi <1021989072@qq.com> add:conan file gdal rep Signed-off-by: tasty-gumi <1021989072@qq.com> remove:gdal fPIC Signed-off-by: tasty-gumi <1021989072@qq.com> fix: for rebase Signed-off-by: tasty-gumi <1021989072@qq.com> remove:log_warn Signed-off-by: tasty-gumi <1021989072@qq.com> remove:gdal shared Signed-off-by: tasty-gumi <1021989072@qq.com> remove:tbbproxy Signed-off-by: tasty-gumi <1021989072@qq.com> fix:add gdal option && update go mod Signed-off-by: tasty-gumi <1021989072@qq.com> dev:change some scripts Signed-off-by: tasty-gumi <1021989072@qq.com> remove: dev scripts Signed-off-by: tasty-gumi <1021989072@qq.com> add:conan files dependency of gdal Signed-off-by: tasty-gumi <1021989072@qq.com> fix:fmt cpp code Signed-off-by: tasty-gumi <1021989072@qq.com> add:delete geos-config in cmake_bulid/bin which may cause permission deny Signed-off-by: tasty-gumi <1021989072@qq.com> fix: add go client geometry interface && fix group by test Signed-off-by: tasty-gumi <1021989072@qq.com> fix: mod tidy for tests go client Signed-off-by: tasty-gumi <1021989072@qq.com> fix:memory leak in test and go fmt Signed-off-by: tasty-gumi <1021989072@qq.com> fix: datagen function remove pkoffset Signed-off-by: tasty-gumi <1021989072@qq.com> fix: go-client test add entity.geometry Signed-off-by: tasty-gumi <1021989072@qq.com> fix: fix test args and add some annotations Signed-off-by: tasty-gumi <1021989072@qq.com> fix:name and remove wkt marshl MaxDecimalDigits limit Signed-off-by: tasty-gumi <1021989072@qq.com> fix:misspell Signed-off-by: tasty-gumi <1021989072@qq.com> fix:go client test Signed-off-by: tasty-gumi <1021989072@qq.com>
- Loading branch information
1 parent
ebc3c82
commit 9fba036
Showing
98 changed files
with
3,866 additions
and
743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
package column | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cockroachdb/errors" | ||
|
||
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb" | ||
"github.com/milvus-io/milvus/client/v2/entity" | ||
) | ||
|
||
type ColumnGeometryBytes struct { | ||
ColumnBase | ||
name string | ||
values [][]byte | ||
} | ||
|
||
// Name returns column name. | ||
func (c *ColumnGeometryBytes) Name() string { | ||
return c.name | ||
} | ||
|
||
// Type returns column entity.FieldType. | ||
func (c *ColumnGeometryBytes) Type() entity.FieldType { | ||
return entity.FieldTypeGeometry | ||
} | ||
|
||
// Len returns column values length. | ||
func (c *ColumnGeometryBytes) Len() int { | ||
return len(c.values) | ||
} | ||
|
||
func (c *ColumnGeometryBytes) Slice(start, end int) Column { | ||
l := c.Len() | ||
if start > l { | ||
start = l | ||
} | ||
if end == -1 || end > l { | ||
end = l | ||
} | ||
return &ColumnGeometryBytes{ | ||
ColumnBase: c.ColumnBase, | ||
name: c.name, | ||
values: c.values[start:end], | ||
} | ||
} | ||
|
||
// Get returns value at index as interface{}. | ||
func (c *ColumnGeometryBytes) Get(idx int) (interface{}, error) { | ||
if idx < 0 || idx > c.Len() { | ||
return nil, errors.New("index out of range") | ||
} | ||
return c.values[idx], nil | ||
} | ||
|
||
func (c *ColumnGeometryBytes) GetAsString(idx int) (string, error) { | ||
bs, err := c.ValueByIdx(idx) | ||
if err != nil { | ||
return "", err | ||
} | ||
return string(bs), nil | ||
} | ||
|
||
// FieldData return column data mapped to schemapb.FieldData. | ||
func (c *ColumnGeometryBytes) FieldData() *schemapb.FieldData { | ||
fd := &schemapb.FieldData{ | ||
Type: schemapb.DataType_Geometry, | ||
FieldName: c.name, | ||
} | ||
|
||
fd.Field = &schemapb.FieldData_Scalars{ | ||
Scalars: &schemapb.ScalarField{ | ||
Data: &schemapb.ScalarField_GeometryData{ | ||
GeometryData: &schemapb.GeometryArray{ | ||
Data: c.values, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
return fd | ||
} | ||
|
||
// ValueByIdx returns value of the provided index. | ||
func (c *ColumnGeometryBytes) ValueByIdx(idx int) ([]byte, error) { | ||
if idx < 0 || idx >= c.Len() { | ||
return nil, errors.New("index out of range") | ||
} | ||
return c.values[idx], nil | ||
} | ||
|
||
// AppendValue append value into column. | ||
func (c *ColumnGeometryBytes) AppendValue(i interface{}) error { | ||
var v []byte | ||
switch raw := i.(type) { | ||
case []byte: | ||
v = raw | ||
case string: | ||
v = []byte(raw) | ||
default: | ||
return fmt.Errorf("expect geometry compatible type([]byte, struct, map), got %T", i) | ||
} | ||
c.values = append(c.values, v) | ||
|
||
return nil | ||
} | ||
|
||
// Data returns column data. | ||
func (c *ColumnGeometryBytes) Data() [][]byte { | ||
return c.values | ||
} | ||
|
||
func NewColumnGeometryBytes(name string, values [][]byte) *ColumnGeometryBytes { | ||
return &ColumnGeometryBytes{ | ||
name: name, | ||
values: values, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package column | ||
|
||
import ( | ||
"fmt" | ||
"math/rand" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/suite" | ||
|
||
"github.com/milvus-io/milvus/client/v2/entity" | ||
) | ||
|
||
type ColumnGeometryBytesSuite struct { | ||
suite.Suite | ||
} | ||
|
||
func (s *ColumnGeometryBytesSuite) SetupSuite() { | ||
rand.Seed(time.Now().UnixNano()) | ||
} | ||
|
||
func (s *ColumnGeometryBytesSuite) TestAttrMethods() { | ||
columnName := fmt.Sprintf("column_Geometrybs_%d", rand.Int()) | ||
columnLen := 8 + rand.Intn(10) | ||
|
||
v := make([][]byte, columnLen) | ||
column := NewColumnGeometryBytes(columnName, v) | ||
|
||
s.Run("test_meta", func() { | ||
ft := entity.FieldTypeGeometry | ||
s.Equal("Geometry", ft.Name()) | ||
s.Equal("Geometry", ft.String()) | ||
pbName, pbType := ft.PbFieldType() | ||
s.Equal("Geometry", pbName) | ||
s.Equal("Geometry", pbType) | ||
}) | ||
|
||
s.Run("test_column_attribute", func() { | ||
s.Equal(columnName, column.Name()) | ||
s.Equal(entity.FieldTypeGeometry, column.Type()) | ||
s.Equal(columnLen, column.Len()) | ||
s.EqualValues(v, column.Data()) | ||
}) | ||
|
||
s.Run("test_column_field_data", func() { | ||
fd := column.FieldData() | ||
s.NotNil(fd) | ||
s.Equal(fd.GetFieldName(), columnName) | ||
}) | ||
|
||
s.Run("test_column_valuer_by_idx", func() { | ||
_, err := column.ValueByIdx(-1) | ||
s.Error(err) | ||
_, err = column.ValueByIdx(columnLen) | ||
s.Error(err) | ||
for i := 0; i < columnLen; i++ { | ||
v, err := column.ValueByIdx(i) | ||
s.NoError(err) | ||
s.Equal(column.values[i], v) | ||
} | ||
}) | ||
|
||
s.Run("test_append_value", func() { | ||
item := make([]byte, 10) | ||
err := column.AppendValue(item) | ||
s.NoError(err) | ||
s.Equal(columnLen+1, column.Len()) | ||
val, err := column.ValueByIdx(columnLen) | ||
s.NoError(err) | ||
s.Equal(item, val) | ||
|
||
err = column.AppendValue(&struct{ Tag string }{Tag: "abc"}) | ||
s.NoError(err) | ||
|
||
err = column.AppendValue(map[string]interface{}{"Value": 123}) | ||
s.NoError(err) | ||
|
||
err = column.AppendValue(1) | ||
s.Error(err) | ||
}) | ||
} | ||
|
||
func TestColumnGeometryBytes(t *testing.T) { | ||
suite.Run(t, new(ColumnGeometryBytesSuite)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.