Skip to content

[hive]add retention seconds in hive catalog.#4367

Closed
YanZhangN wants to merge 1 commit intoapache:masterfrom
YanZhangN:master
Closed

[hive]add retention seconds in hive catalog.#4367
YanZhangN wants to merge 1 commit intoapache:masterfrom
YanZhangN:master

Conversation

@YanZhangN
Copy link
Copy Markdown
Contributor

@YanZhangN YanZhangN commented Oct 23, 2024

Purpose

Add retention properties for hive metastore according to 'partition.expiration-time'.

Linked issue: close #xxx

Tests

API and Format

Documentation

if (provider == null) {
provider = "paimon";
}
CoreOptions coreOptions = CoreOptions.fromMap(tableParameters);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Duration partitionExpireTime = coreOptions.partitionExpireTime();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

int retention =
coreOptions.partitionExpireTime() == null
? Integer.MAX_VALUE
: (int) coreOptions.partitionExpireTime().getSeconds();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a risk of data overflow here?
getSeconds return long, then cast int.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@JingsongLi
Copy link
Copy Markdown
Contributor

Can you provide the specific application of this attribute? For example, Hive first introduced it with JIRA, etc.

java.time.Duration partitionExpireTime = coreOptions.partitionExpireTime();
int retention = Integer.MAX_VALUE;
if (partitionExpireTime != null && partitionExpireTime.getSeconds() <= Integer.MAX_VALUE) {
retention = (int) partitionExpireTime.getSeconds();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe only set it with metastore.partitioned-table enabled.

@JingsongLi
Copy link
Copy Markdown
Contributor

I am not sure this field is for partition retention.

Maybe we can use properties to store this option.

@JingsongLi
Copy link
Copy Markdown
Contributor

Close this first, feel free to re-open this.

@JingsongLi JingsongLi closed this Oct 30, 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