You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "LiuQhahah (via GitHub)" <gi...@apache.org> on 2024/08/08 15:53:22 UTC
[PR] #4412 add validate check for ColumnPosition when updating column posi… [gravitino]
LiuQhahah opened a new pull request, #4451:
URL: https://github.com/apache/gravitino/pull/4451
…tions
<!--
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?
add validate check for ColumnPosition when updating column positions,
If the position is default, will throw exception.
### Why are the changes needed?
Fix: #4412
### Does this PR introduce _any_ user-facing change?
### How was this patch tested?
the UT has been added.
--
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] #4412 add validate check for ColumnPosition when updating column posi… [gravitino]
Posted by "FANNG1 (via GitHub)" <gi...@apache.org>.
FANNG1 commented on code in PR #4451:
URL: https://github.com/apache/gravitino/pull/4451#discussion_r1710459548
##########
api/src/main/java/org/apache/gravitino/rel/TableChange.java:
##########
@@ -1353,6 +1353,9 @@ final class UpdateColumnPosition implements ColumnChange {
private final ColumnPosition position;
private UpdateColumnPosition(String[] fieldName, ColumnPosition position) {
+ if (position instanceof Default){
Review Comment:
please use Preconditions.checkArgument
--
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] #4412 add validate check for ColumnPosition when updating column posi… [gravitino]
Posted by "FANNG1 (via GitHub)" <gi...@apache.org>.
FANNG1 commented on code in PR #4451:
URL: https://github.com/apache/gravitino/pull/4451#discussion_r1711579747
##########
catalogs/catalog-lakehouse-iceberg/src/test/java/org/apache/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergBaseIT.java:
##########
@@ -613,7 +613,7 @@ public void testUpdateIcebergColumnDefaultPosition() {
.alterTable(
Review Comment:
please remove the test
--
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] #4412 add validate check for ColumnPosition when updating column posi… [gravitino]
Posted by "FANNG1 (via GitHub)" <gi...@apache.org>.
FANNG1 commented on code in PR #4451:
URL: https://github.com/apache/gravitino/pull/4451#discussion_r1713887227
##########
api/src/test/java/org/apache/gravitino/TestTableChange.java:
##########
@@ -168,6 +168,17 @@ public void testUpdateNestedColumnPosition() {
assertEquals(newPosition, updateColumnPosition.getPosition());
}
+ @Test
+ public void testDoesNotAllowDefaultInColumnPosition() {
+ String[] fieldName = {"Name", "Last Name"};
+ ColumnPosition newPosition = TableChange.ColumnPosition.defaultPos();
+ try {
Review Comment:
please use `Assertions.assertThrowsExactly(xxx)` to do the check
--
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] [#4412] feat(api): add validate check for default position when updating column position [gravitino]
Posted by "FANNG1 (via GitHub)" <gi...@apache.org>.
FANNG1 merged PR #4451:
URL: https://github.com/apache/gravitino/pull/4451
--
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] #4412 add validate check for ColumnPosition when updating column posi… [gravitino]
Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on PR #4451:
URL: https://github.com/apache/gravitino/pull/4451#issuecomment-2283529485
Looks like there's some style issue needs to be fixed, @LiuQhahah would you please fix 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] #4412 add validate check for ColumnPosition when updating column posi… [gravitino]
Posted by "FANNG1 (via GitHub)" <gi...@apache.org>.
FANNG1 commented on PR #4451:
URL: https://github.com/apache/gravitino/pull/4451#issuecomment-2276913622
@LiuQhahah , please fix the ci and test failures like `CatalogIcebergBaseIT#testUpdateIcebergColumnDefaultPosition`
--
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] #4412 add validate check for ColumnPosition when updating column posi… [gravitino]
Posted by "FANNG1 (via GitHub)" <gi...@apache.org>.
FANNG1 commented on PR #4451:
URL: https://github.com/apache/gravitino/pull/4451#issuecomment-2285129674
There're some residual logic to process DefaultColumnPosition in `IcebergTableOpsHelper.java`, do you like to remove it in this PR?
```java
private void doUpdateColumnPosition(
UpdateSchema icebergUpdateSchema,
UpdateColumnPosition updateColumnPosition,
Schema icebergTableSchema) {
StructType tableSchema = icebergTableSchema.asStruct();
// not need any more
ColumnPosition columnPosition =
getColumnPositionForIceberg(tableSchema, updateColumnPosition.getPosition());
doMoveColumn(icebergUpdateSchema, updateColumnPosition.fieldName(), columnPosition);
}
```
--
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] #4412 add validate check for ColumnPosition when updating column posi… [gravitino]
Posted by "LiuQhahah (via GitHub)" <gi...@apache.org>.
LiuQhahah commented on code in PR #4451:
URL: https://github.com/apache/gravitino/pull/4451#discussion_r1711454434
##########
api/src/main/java/org/apache/gravitino/rel/TableChange.java:
##########
@@ -1353,6 +1353,9 @@ final class UpdateColumnPosition implements ColumnChange {
private final ColumnPosition position;
private UpdateColumnPosition(String[] fieldName, ColumnPosition position) {
+ if (position instanceof Default){
Review Comment:
Hi @FANNG1
I have use Preconditions.checkArgument for hanlding the argument.
Thanks
Qiang
--
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] #4412 add validate check for ColumnPosition when updating column posi… [gravitino]
Posted by "LiuQhahah (via GitHub)" <gi...@apache.org>.
LiuQhahah commented on PR #4451:
URL: https://github.com/apache/gravitino/pull/4451#issuecomment-2277934175
I have fixed the testUpdateIcebergColumnDefaultPosition UT and formated the code.
--
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] [#4412] feat(api): add validate check for default position when updating column position [gravitino]
Posted by "FANNG1 (via GitHub)" <gi...@apache.org>.
FANNG1 commented on PR #4451:
URL: https://github.com/apache/gravitino/pull/4451#issuecomment-2286358436
@LiuQhahah , thanks for your contribution, and hope you enjoy the journey.
--
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