Skip to content

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.

case STRING:
return LocalDateTime.ofInstant(
Instant.ofEpochMilli(expireTimestamp), getDefaultZoneId(field))
.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

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.

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!!!

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 for the contribution!
I left a minor suggestion.

}

/**
* Convert expiration timestamp to appropriate value based on field type. This method handles
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to format the comment here to make it more readable:

  /**
   * Convert expiration timestamp to the appropriate value based on field type.
   *
   * <p>This method handles different field types for data expiration:
   *
   * <ul>
   *   <li>TIMESTAMP: converts milliseconds to microseconds
   *   <li>LONG: handles both millisecond and second formats
   *   <li>STRING: formats timestamp as date string using configured pattern
   *   <li>DATE: converts timestamp to days since epoch
   * </ul>
   *
   * @param expirationConfig expiration configuration containing format patterns
   * @param field the field being used for expiration
   * @param expireTimestamp timestamp in milliseconds for expiration boundary
   * @return comparable value appropriate for the field type
   */

@zhoujinsong
Copy link
Contributor

Besides, there seem to be some unit test errors that need to be fixed. @lsyulong

@zhoujinsong
Copy link
Contributor

@lsyulong do you still have time to fix the issues in CI or can I help you fix it if you need?

@lsyulong
Copy link
Author

@lsyulong do you still have time to fix the issues in CI or can I help you fix it if you need?

@zhoujinsong Sorry, due to recent time issues, this issue has been put on hold. Can you help fix other issues? I need your help.

@github-actions
Copy link

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Oct 24, 2025
@github-actions
Copy link

This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions bot closed this Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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