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

Fix some small bugs and improve experience #289

Merged
merged 4 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import com.baidu.hugegraph.service.load.JobManagerService;
import com.baidu.hugegraph.service.schema.EdgeLabelService;
import com.baidu.hugegraph.service.schema.VertexLabelService;
import com.baidu.hugegraph.util.CollectionUtil;
import com.baidu.hugegraph.util.Ex;
import com.baidu.hugegraph.util.HubbleUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
Expand Down Expand Up @@ -299,6 +300,21 @@ private void checkVertexMappingValid(int connId, VertexMapping vertexMapping,
Ex.check(columnNames.containsAll(vertexMapping.getIdFields()),
"load.file-mapping.vertex.id-fields-should-in-column-names",
vertexMapping.getIdFields(), columnNames);
if (vl.getIdStrategy().isPrimaryKey()) {
Ex.check(vertexMapping.getIdFields().size() ==
vl.getPrimaryKeys().size(),
"load.file-mapping.vertex.id-fields-should-same-size-pks");
Ex.check(!CollectionUtils.containsAny(
vertexMapping.fieldMappingToMap().values(),
vl.getPrimaryKeys()),
"load.file-mapping.vertex.mapping-fields-cannot-contains-pk");
} else {
Ex.check(vertexMapping.getIdFields().size() == 1,
"load.file-mapping.vertex.id-fields-should-only-one");
}
Ex.check(CollectionUtil.allUnique(
vertexMapping.fieldMappingToMap().values()),
"load.file-mapping.mapping-fields-should-no-duplicate");
this.checkMappingValid(vertexMapping, fileMapping);
}

Expand All @@ -324,6 +340,9 @@ private void checkEdgeMappingValid(int connId, EdgeMapping edgeMapping,
Ex.check(columnNames.containsAll(edgeMapping.getTargetFields()),
"load.file-mapping.edge.target-fields-should-in-column-names",
edgeMapping.getTargetFields(), columnNames);
Ex.check(CollectionUtil.allUnique(
edgeMapping.fieldMappingToMap().values()),
"load.file-mapping.mapping-fields-should-no-duplicate");
this.checkMappingValid(edgeMapping, fileMapping);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.baidu.hugegraph.entity.schema.VertexLabelEntity;
import com.baidu.hugegraph.entity.schema.VertexLabelStyle;
import com.baidu.hugegraph.entity.schema.VertexLabelUpdateEntity;
import com.baidu.hugegraph.exception.ExternalException;
import com.baidu.hugegraph.service.schema.PropertyIndexService;
import com.baidu.hugegraph.service.schema.PropertyKeyService;
import com.baidu.hugegraph.service.schema.VertexLabelService;
Expand Down Expand Up @@ -195,11 +196,20 @@ public Map<String, Boolean> checkUsing(

@DeleteMapping
public void delete(@PathVariable("connId") int connId,
@RequestParam("names") List<String> names) {
@RequestParam("names") List<String> names,
@RequestParam(name = "skip_using",
defaultValue = "false")
boolean skipUsing) {
for (String name : names) {
this.vlService.checkExist(name, connId);
Ex.check(!this.vlService.checkUsing(name, connId),
"schema.vertexlabel.in-using", name);
if (this.vlService.checkUsing(name, connId)) {
if (skipUsing) {
continue;
} else {
throw new ExternalException("schema.vertexlabel.in-using",
name);
}
}
this.vlService.remove(name, connId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private void fillProperties(int connId, SchemaLabelEntity schema,
try {
// DataTypeUtil.convert in loader need param InputSource
FileSource source = new FileSource();
ListFormat listFormat = new ListFormat("[", "]", ",");
ListFormat listFormat = new ListFormat("", "", ",");
source.listFormat(listFormat);
value = DataTypeUtil.convert(rawValue, propertyKey, source);
} catch (IllegalArgumentException e) {
Expand Down
4 changes: 4 additions & 0 deletions hubble-be/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,13 @@ load.file-mapping.vertex.not-exist.label=The vertex mapping doesn't exist with l
load.file-mapping.vertex.automatic-id-unsupported=The id strategy of the current vertex label is AUTOMATIC. Such data load operations are not supported. Please implement it by calling the API.
load.file-mapping.vertex.id-fields-cannot-be-empty=The id fields can't be empty
load.file-mapping.vertex.id-fields-should-in-column-names=The all id fields {0} should be existed in columns names {1}
load.file-mapping.vertex.id-fields-should-same-size-pks=The id strategy of the current vertex label is PRIMARYKEY, the id fields should be consistent with the number of primary keys
load.file-mapping.vertex.mapping-fields-cannot-contains-pk=The id strategy of the current vertex label is PRIMARYKEY, the mapping properties can no longer contain primary keys
load.file-mapping.vertex.id-fields-should-only-one=The id strategy of the current vertex label is PRIMARYKEY, an id field should be specified
load.file-mapping.edge.not-exist.label=The edge mapping doesn't exist with label {0}
load.file-mapping.edge.source-fields-cannot-be-empty=The source fields can't be empty
load.file-mapping.edge.target-fields-cannot-be-empty=The target fields can't be empty
load.file-mapping.mapping-fields-should-no-duplicate=Multiple fields are not allowed to map to same property
load.file-mapping.load-parameter.max-parse-error.illegal=The load parameter 'max-parse-errors' is illegal
load.file-mapping.load-parameter.max-insert-error.illegal=The load parameter 'max-insert-errors' is illegal
load.file-mapping.load-parameter.insert-timeout.illegal=The load parameter 'insert-timeout' is illegal
Expand Down
4 changes: 4 additions & 0 deletions hubble-be/src/main/resources/i18n/messages_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,13 @@ load.file-mapping.vertex.not-exist.label=不存在 label 为 {0} 的顶点映射
load.file-mapping.vertex.automatic-id-unsupported=当前顶点类型的 ID 策略为自动生成,不支持此类数据导入操作,请通过调用 API 实现
load.file-mapping.vertex.id-fields-cannot-be-empty=ID 列不能为空
load.file-mapping.vertex.id-fields-should-in-column-names=ID 列 {0} 必须都属于文件列 {1}
load.file-mapping.vertex.id-fields-should-same-size-pks=当前顶点类型的 ID 策略为主键属性,ID 列应该与主键属性个数一致
load.file-mapping.vertex.mapping-fields-cannot-contains-pk=当前顶点类型的 ID 策略为主键属性,映射的属性中不能再包含主键属性
load.file-mapping.vertex.id-fields-should-only-one=当前顶点类型的 ID 策略为自定义,应指定一个 ID 列
load.file-mapping.edge.not-exist.label=不存在 label 为 {0} 的边映射
load.file-mapping.edge.source-fields-cannot-be-empty=起点 ID 列不能为空
load.file-mapping.edge.target-fields-cannot-be-empty=终点 ID 列不能为空
load.file-mapping.mapping-fields-should-no-duplicate=不允许多列映射到同一属性
load.file-mapping.load-parameter.max-parse-error.illegal=导入参数 允许最大解析错误行数 不合法
load.file-mapping.load-parameter.max-insert-error.illegal=导入参数 允许最大插入错误行数 不合法
load.file-mapping.load-parameter.insert-timeout.illegal=导入参数 插入超时时间/s 不合法
Expand Down