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

[core] Support timestamp field type in record level expire #4417

Merged
merged 4 commits into from
Nov 5, 2024

Conversation

askwang
Copy link
Contributor

@askwang askwang commented Oct 31, 2024

Purpose

Record level expiration supports timestamp type and timestamp_ltz type.

Tests

API and Format

Documentation

@askwang askwang closed this Oct 31, 2024
@askwang askwang reopened this Oct 31, 2024
&& field.type() instanceof BigIntType)
|| (timeFieldType == CoreOptions.TimeFieldType.MILLIS_LONG
&& field.type() instanceof BigIntType))) {
if (!isValidateFieldType(timeFieldType, field)) {
throw new IllegalArgumentException(
String.format(
"The record level time field type should be one of SECONDS_INT,SECONDS_LONG or MILLIS_LONG, "
Copy link
Contributor

Choose a reason for hiding this comment

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

The record level time field type should be one of SECONDS_INT, SECONDS_LONG, MILLIS_LONG or TIMESTAMP, but time field type is %s, field type is %s.


private static boolean isValidateFieldType(
CoreOptions.TimeFieldType timeFieldType, DataField field) {
return ((timeFieldType == CoreOptions.TimeFieldType.SECONDS_INT
Copy link
Contributor

Choose a reason for hiding this comment

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

DataType dataType = field.type();

long millis = System.currentTimeMillis();
Timestamp timestamp1 = Timestamp.fromEpochMillis(millis - 60 * 1000);
Timestamp timestamp2 = Timestamp.fromEpochMillis(millis);
Timestamp timestamp3 = Timestamp.fromEpochMillis(millis + 60 * 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a ut to test LocalZonedTimestampType?

}

@Test
public void test() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

test what?

@wwj6591812
Copy link
Contributor

Please add Purpose of this pr.

@askwang
Copy link
Contributor Author

askwang commented Oct 31, 2024

Please add Purpose of this pr.

addressed, thanks for your review @wwj6591812

@@ -1351,7 +1351,7 @@ public class CoreOptions implements Serializable {
.enumType(TimeFieldType.class)
.defaultValue(TimeFieldType.SECONDS_INT)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just set this to AUTO? If the field is timestamp, we don't need to set this option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AUTO maybe cannot adapt to all types, just added detailed log.

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

+1

@JingsongLi JingsongLi merged commit 992a406 into apache:master Nov 5, 2024
13 checks passed
hang8929201 pushed a commit to hang8929201/paimon that referenced this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants