You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "luoshipeng (via GitHub)" <gi...@apache.org> on 2025/01/06 07:37:49 UTC
[PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
luoshipeng opened a new pull request, #6114:
URL: https://github.com/apache/gravitino/pull/6114
<!--
1. Title: [#<issue>] <type>(<scope>): <subject>
Examples:
- "[#123] feat(operator): support xxx"
- "[#233] fix: check null before access result in xxx"
- "[MINOR] refactor: fix typo in variable name"
- "[MINOR] docs: fix typo in README"
- "[#255] test: fix flaky test NameOfTheTest"
Reference: https://www.conventionalcommits.org/en/v1.0.0/
2. If the PR is unfinished, please mark this PR as draft.
-->
### What changes were proposed in this pull request?
remove the foreach statement, and get parentEntityId directly.
### Why are the changes needed?
issue: https://github.com/apache/gravitino/issues/4305
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
ut
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#discussion_r1904042062
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java:
##########
@@ -57,4 +57,29 @@ public Long getParentEntityIdByNamespace(Namespace namespace) {
"Parent entity id should not be null and should be greater than 0.");
return parentEntityId;
}
+
+ public Long[] getParentEntityIdsByNamespace(Namespace namespace) {
+ Preconditions.checkArgument(
Review Comment:
Do you need to replace the similar code of `ColumnMetaService`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "xunliu (via GitHub)" <gi...@apache.org>.
xunliu commented on PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#issuecomment-2574326521
hi @luoshipeng Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#discussion_r1904826425
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java:
##########
@@ -57,4 +57,29 @@ public Long getParentEntityIdByNamespace(Namespace namespace) {
"Parent entity id should not be null and should be greater than 0.");
return parentEntityId;
}
+
+ public Long[] getParentEntityIdsByNamespace(Namespace namespace) {
+ Preconditions.checkArgument(
Review Comment:
> ColumnPO get parentEntityId from TablePO, so i think there's no need to replace it
OK. I got it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "luoshipeng (via GitHub)" <gi...@apache.org>.
luoshipeng commented on code in PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#discussion_r1904820862
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java:
##########
@@ -57,4 +57,29 @@ public Long getParentEntityIdByNamespace(Namespace namespace) {
"Parent entity id should not be null and should be greater than 0.");
return parentEntityId;
}
+
+ public Long[] getParentEntityIdsByNamespace(Namespace namespace) {
+ Preconditions.checkArgument(
Review Comment:
ColumnPO get parentEntityId from TablePO, so i think there's no need to replace it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#discussion_r1903852889
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java:
##########
@@ -57,4 +57,29 @@ public Long getParentEntityIdByNamespace(Namespace namespace) {
"Parent entity id should not be null and should be greater than 0.");
return parentEntityId;
}
+
+ public Long[] getParentEntityIdsByNamespace(Namespace namespace) {
+ Preconditions.checkArgument(
+ !namespace.isEmpty() && namespace.levels().length <= 3,
+ "Namespace should not be empty and length should be less than or equal to 3.");
+ Long[] parentEntityIds = new Long[3];
Review Comment:
The length should be the same as namespace's.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#issuecomment-2572493503
Could you extract a common method convert namespace to a list of entity id? Every method can reuse this method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#discussion_r1903926872
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java:
##########
@@ -57,4 +57,29 @@ public Long getParentEntityIdByNamespace(Namespace namespace) {
"Parent entity id should not be null and should be greater than 0.");
return parentEntityId;
}
+
+ public Long[] getParentEntityIdsByNamespace(Namespace namespace) {
+ Preconditions.checkArgument(
Review Comment:
If namespace belongs to a `schema`, the length of namespace will be 2 instead of 3.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#discussion_r1903853406
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java:
##########
@@ -57,4 +57,29 @@ public Long getParentEntityIdByNamespace(Namespace namespace) {
"Parent entity id should not be null and should be greater than 0.");
return parentEntityId;
}
+
+ public Long[] getParentEntityIdsByNamespace(Namespace namespace) {
+ Preconditions.checkArgument(
Review Comment:
The length of schema won't be 3.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "luoshipeng (via GitHub)" <gi...@apache.org>.
luoshipeng commented on PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#issuecomment-2572553342
> Could you extract a common method convert namespace to a list of entity id? Every method can reuse this method.
Hi~ Could you take a look pls
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "luoshipeng (via GitHub)" <gi...@apache.org>.
luoshipeng commented on code in PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#discussion_r1904819923
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java:
##########
@@ -57,4 +57,29 @@ public Long getParentEntityIdByNamespace(Namespace namespace) {
"Parent entity id should not be null and should be greater than 0.");
return parentEntityId;
}
+
+ public Long[] getParentEntityIdsByNamespace(Namespace namespace) {
+ Preconditions.checkArgument(
Review Comment:
I've checked the code of ColumnMetaService, and not found the similar code. Did i miss that?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "xunliu (via GitHub)" <gi...@apache.org>.
xunliu merged PR #6114:
URL: https://github.com/apache/gravitino/pull/6114
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on code in PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#discussion_r1904869547
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/FilesetMetaService.java:
##########
@@ -314,26 +314,10 @@ public int deleteFilesetVersionsByRetentionCount(Long versionRetentionCount, int
private void fillFilesetPOBuilderParentEntityId(FilesetPO.Builder builder, Namespace namespace) {
NamespaceUtil.checkFileset(namespace);
- Long parentEntityId = null;
- for (int level = 0; level < namespace.levels().length; level++) {
- String name = namespace.level(level);
- switch (level) {
- case 0:
- parentEntityId = MetalakeMetaService.getInstance().getMetalakeIdByName(name);
- builder.withMetalakeId(parentEntityId);
- continue;
- case 1:
- parentEntityId =
- CatalogMetaService.getInstance()
- .getCatalogIdByMetalakeIdAndName(parentEntityId, name);
- builder.withCatalogId(parentEntityId);
- continue;
- case 2:
- parentEntityId =
- SchemaMetaService.getInstance().getSchemaIdByCatalogIdAndName(parentEntityId, name);
- builder.withSchemaId(parentEntityId);
- break;
- }
- }
+ Long[] parentEntityIds =
+ CommonMetaService.getInstance().getParentEntityIdsByNamespace(namespace);
+ builder.withMetalakeId(parentEntityIds[0]);
+ builder.withCatalogId(parentEntityIds[1]);
+ builder.withSchemaId(parentEntityIds[2]);
Review Comment:
Maybe we can change to this style for here and below.
```java
builder.withMetalakeId(parentEntityIds[0])
.withCatalogId(parentEntityIds[1]);
.withSchemaId(parentEntityIds[2]);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "luoshipeng (via GitHub)" <gi...@apache.org>.
luoshipeng commented on PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#issuecomment-2572499924
> Could you extract a common method convert namespace to a list of entity id? Every method can reuse this method.
OK
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "luoshipeng (via GitHub)" <gi...@apache.org>.
luoshipeng commented on code in PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#discussion_r1903863309
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java:
##########
@@ -57,4 +57,29 @@ public Long getParentEntityIdByNamespace(Namespace namespace) {
"Parent entity id should not be null and should be greater than 0.");
return parentEntityId;
}
+
+ public Long[] getParentEntityIdsByNamespace(Namespace namespace) {
+ Preconditions.checkArgument(
Review Comment:
so this is the same problem as the last one?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#4305] improvement(core): Improved the way of fill parentEntityId in POBuilder [gravitino]
Posted by "luoshipeng (via GitHub)" <gi...@apache.org>.
luoshipeng commented on code in PR #6114:
URL: https://github.com/apache/gravitino/pull/6114#discussion_r1903970596
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/CommonMetaService.java:
##########
@@ -57,4 +57,29 @@ public Long getParentEntityIdByNamespace(Namespace namespace) {
"Parent entity id should not be null and should be greater than 0.");
return parentEntityId;
}
+
+ public Long[] getParentEntityIdsByNamespace(Namespace namespace) {
+ Preconditions.checkArgument(
Review Comment:
Yeah. so if i update the array length to namespace's length, it will solve this problem.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org