enhance: Resolve existing lint issues (#40797)

This PR
- Format import issues in datacoord & datanode
- Fix JSONPathIndex naming issue

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2025-03-20 19:36:11 +08:00 committed by GitHub
parent e23f429299
commit 77515310b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 15 additions and 12 deletions

View File

@ -20,24 +20,24 @@ import (
"github.com/milvus-io/milvus/pkg/v2/common"
)
var _ Index = &JsonPathIndex{}
var _ Index = &JSONPathIndex{}
// JsonPathIndex is the pre-defined index model for json path scalar index.
type JsonPathIndex struct {
// JSONPathIndex is the pre-defined index model for json path scalar index.
type JSONPathIndex struct {
scalarIndex
jsonCastType string
jsonPath string
}
// WithIndexName setup the index name of JsonPathIndex.
func (idx *JsonPathIndex) WithIndexName(name string) *JsonPathIndex {
func (idx *JSONPathIndex) WithIndexName(name string) *JSONPathIndex {
idx.name = name
return idx
}
// Params implements Index interface
// returns the create index related parameters.
func (idx *JsonPathIndex) Params() map[string]string {
func (idx *JSONPathIndex) Params() map[string]string {
return map[string]string{
IndexTypeKey: string(idx.indexType),
common.JSONCastTypeKey: idx.jsonCastType,
@ -45,9 +45,9 @@ func (idx *JsonPathIndex) Params() map[string]string {
}
}
// NewJsonPathIndex creates a `JsonPathIndex` with provided parameters.
func NewJsonPathIndex(indexType IndexType, jsonCastType string, jsonPath string) *JsonPathIndex {
return &JsonPathIndex{
// NewJSONPathIndex creates a `JsonPathIndex` with provided parameters.
func NewJSONPathIndex(indexType IndexType, jsonCastType string, jsonPath string) *JSONPathIndex {
return &JSONPathIndex{
scalarIndex: scalarIndex{
indexType: indexType,
},

View File

@ -36,7 +36,7 @@ func TestJsonPathIndex(t *testing.T) {
indexType := indexTypes[rand.Intn(len(indexTypes))]
castType := jsonCastTypes[rand.Intn(len(jsonCastTypes))]
idx := NewJsonPathIndex(indexType, castType, jsonPath).WithIndexName(indexName)
idx := NewJSONPathIndex(indexType, castType, jsonPath).WithIndexName(indexName)
assert.Equal(t, indexType, idx.IndexType())
assert.Equal(t, indexName, idx.Name())

View File

@ -19,9 +19,10 @@ package datacoord
import (
"context"
"fmt"
"strconv"
"go.uber.org/zap"
"google.golang.org/protobuf/proto"
"strconv"
"github.com/milvus-io/milvus/internal/metastore"
"github.com/milvus-io/milvus/pkg/v2/log"

View File

@ -26,6 +26,7 @@ package index
#include "indexbuilder/init_c.h"
*/
import "C"
import (
"path"
"path/filepath"

View File

@ -17,6 +17,7 @@
package index
import "C"
import (
"context"
"sync"

View File

@ -20,13 +20,12 @@ import (
"context"
"testing"
"github.com/milvus-io/milvus/internal/util/dependency"
"github.com/stretchr/testify/suite"
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
"github.com/milvus-io/milvus/internal/storage"
"github.com/milvus-io/milvus/internal/util/dependency"
"github.com/milvus-io/milvus/pkg/v2/common"
"github.com/milvus-io/milvus/pkg/v2/proto/etcdpb"
"github.com/milvus-io/milvus/pkg/v2/proto/indexpb"

View File

@ -26,6 +26,7 @@ package index
#include "indexbuilder/init_c.h"
*/
import "C"
import (
"github.com/cockroachdb/errors"