-
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 <[email protected]> add geospatial interface in src common change type define and add segcore support change: use wkb only in core Signed-off-by: tasty-gumi <[email protected]> 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 <[email protected]> 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 <[email protected]> fix: some format of code && segmentfault debug for rebase Signed-off-by: tasty-gumi <[email protected]> add: import util test for parquet and mix compaction test Signed-off-by: tasty-gumi <[email protected]> fix: delete useless file and fix error for rebase Signed-off-by: tasty-gumi <[email protected]> fix: git rebase for custom function feat Signed-off-by: tasty-gumi <[email protected]> fix:rename geospatial field && update proto && rewrite Geometry class with smart pointer Signed-off-by: tasty-gumi <[email protected]> add:last commit miss add files Signed-off-by: tasty-gumi <[email protected]> fix: geospatial name replace in test files && fix geomertry and parser fix:remove some file change for dev Signed-off-by: tasty-gumi <[email protected]> fix:remove size in if && add destory in ~Geometry() Signed-off-by: tasty-gumi <[email protected]> add:conan file gdal rep Signed-off-by: tasty-gumi <[email protected]> remove:gdal fPIC Signed-off-by: tasty-gumi <[email protected]> fix: for rebase Signed-off-by: tasty-gumi <[email protected]> remove:log_warn Signed-off-by: tasty-gumi <[email protected]> remove:gdal shared Signed-off-by: tasty-gumi <[email protected]> remove:tbbproxy Signed-off-by: tasty-gumi <[email protected]> fix:add gdal option && update go mod Signed-off-by: tasty-gumi <[email protected]> dev:change some scripts Signed-off-by: tasty-gumi <[email protected]> remove: dev scripts Signed-off-by: tasty-gumi <[email protected]> add:conan files dependency of gdal Signed-off-by: tasty-gumi <[email protected]> fix:fmt cpp code Signed-off-by: tasty-gumi <[email protected]> add:delete geos-config in cmake_bulid/bin which may cause permission deny Signed-off-by: tasty-gumi <[email protected]> fix: add go client geometry interface && fix group by test Signed-off-by: tasty-gumi <[email protected]> fix: mod tidy for tests go client Signed-off-by: tasty-gumi <[email protected]> fix:memory leak in test and go fmt Signed-off-by: tasty-gumi <[email protected]> fix: datagen function remove pkoffset Signed-off-by: tasty-gumi <[email protected]> fix: go-client test add entity.geometry Signed-off-by: tasty-gumi <[email protected]> fix: fix test args and add some annotations Signed-off-by: tasty-gumi <[email protected]>
- Loading branch information
1 parent
40b770c
commit 82ff5e2
Showing
98 changed files
with
3,768 additions
and
662 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
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
Oops, something went wrong.