forked from milvus-io/milvus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance: Add max length check for csv import (milvus-io#37077)
1. Add max length check for csv import. 2. Tidy import options. 3. Tidy common import util functions. issue: milvus-io#34150 --------- Signed-off-by: bigsheeper <[email protected]>
- Loading branch information
1 parent
088d5d7
commit b45cf2d
Showing
16 changed files
with
277 additions
and
78 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
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,68 @@ | ||
// Licensed to the LF AI & Data foundation under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package common | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"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/pkg/common" | ||
) | ||
|
||
func TestUtil_EstimateReadCountPerBatch(t *testing.T) { | ||
schema := &schemapb.CollectionSchema{ | ||
Fields: []*schemapb.FieldSchema{ | ||
{ | ||
FieldID: 100, | ||
Name: "pk", | ||
IsPrimaryKey: true, | ||
DataType: schemapb.DataType_Int64, | ||
}, | ||
{ | ||
FieldID: 101, | ||
Name: "vec", | ||
DataType: schemapb.DataType_FloatVector, | ||
TypeParams: []*commonpb.KeyValuePair{ | ||
{ | ||
Key: common.DimKey, | ||
Value: "128", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
count, err := EstimateReadCountPerBatch(16*1024*1024, schema) | ||
assert.NoError(t, err) | ||
assert.Equal(t, int64(1000), count) | ||
|
||
schema.Fields = append(schema.Fields, &schemapb.FieldSchema{ | ||
FieldID: 102, | ||
Name: "vec2", | ||
DataType: schemapb.DataType_FloatVector, | ||
TypeParams: []*commonpb.KeyValuePair{ | ||
{ | ||
Key: common.DimKey, | ||
Value: "invalidDim", | ||
}, | ||
}, | ||
}) | ||
_, err = EstimateReadCountPerBatch(16*1024*1024, schema) | ||
assert.Error(t, err) | ||
} |
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
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.