Skip to content

[AMORO-3632]: data-retention, add support for partition column type Date #3665

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lsyulong
Copy link

Why are the changes needed?

Close #3632

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not documented)

@github-actions github-actions bot added the module:ams-server Ams server module label Jul 11, 2025
Copy link
Contributor

@zhoujinsong zhoujinsong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the contribution!

Can you add some unit test case to cover this new feature?

@lsyulong
Copy link
Author

Thanks a lot for the contribution!

Can you add some unit test case to cover this new feature?

OK, no problem

@lsyulong
Copy link
Author

Thanks a lot for the contribution!

Can you add some unit test case to cover this new feature?

@zhoujinsong I have added a new test case. Can you review the code to see if there is any problem? tks!

Copy link
Member

@klion26 klion26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lsyulong thanks for the contribution, I left some comments inline, please let me what do you think about this.

@@ -764,6 +764,9 @@ private Comparable<?> getExpireValue(
.format(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please help to add some comments for this function, thanks

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -1037,8 +1047,13 @@ private boolean canBeExpireByPartitionValue(
}

int compared = filePartitionValue.compareTo(partitionUpperBound);
Boolean compareResult =
expireField.type() == Types.StringType.get() ? compared <= 0 : compared < 0;
Boolean compareResult;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we add DateType to the special case? if the bound is the problem, could we calculate the bound with `(int) ((expireTimestamp + 24 * 60 * 60 * 1000) + / (24 * 60 * 60 * 1000))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am re-adjusting the date boundary value calculation problem. This part still maintains the original string type calculation logic.

@@ -373,6 +416,10 @@ private void testUnKeyedFileLevel() {
expected =
Lists.newArrayList(
createRecord(2, "222", parseMillis("2022-01-03T12:00:00"), "2022-01-03T12:00:00"));
} else if (expireByDate()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add some more tests to cover the bound case(eg, 2022-01-03T23:59:59, 2022-01-03T00:00:00, 2022-01-03T00:00:01)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@lsyulong
Copy link
Author

@klion26 @zhoujinsong teachers,Could you please help me look at the code again? I have added a few boundary test cases, but there are still some problems during the test. I am a little confused. test command: mvn test -Dtest=TestDataExpire#testDateTypeBoundaryConditions* -pl amoro-ams
test.log
tks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:ams-server Ams server module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: data-retention, add support for partition column type Date
3 participants