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] CoreOptions.fileFormat is cpu expensive, because FileFormat initalization is costly. As much as we can, reduce the rate. #4782

Merged
merged 10 commits into from
Dec 26, 2024

Conversation

leaves12138
Copy link
Contributor

@leaves12138 leaves12138 commented Dec 26, 2024

Purpose

Just don't call options.fileformat as much as you want.

Tests

API and Format

Documentation

…italizing is costly. As much as we can, reduce the rate
@@ -88,7 +103,7 @@ public static FileFormat fromIdentifier(String identifier, Options options) {

/** Create a {@link FileFormat} from format identifier and format options. */
public static FileFormat fromIdentifier(String identifier, FormatContext context) {
return fromIdentifier(identifier, context, FileFormat.class.getClassLoader())
return getFileFormatFromLoadedCache(identifier, context)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use org.apache.paimon.factories.FactoryUtil

@@ -101,11 +104,13 @@ protected AbstractFileStore(
this.writeManifestCache =
SegmentsCache.create(
options.pageSize(), options.writeManifestCache(), Long.MAX_VALUE);
this.fileFormat = options.fileFormat();
this.pathFactory = pathFactory(fileFormat.getFormatIdentifier());
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't create path factory here... It should be created one by one

import java.util.ServiceLoader;

/** Base Factory Util. */
public class BaseFactoryUtil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not introduce this method, it has no abstraction... Just put static method into FactoryUtil.

@@ -120,6 +121,7 @@ public AppendOnlyFileStoreWrite newWrite(
commitUser,
rowType,
partitionType,
options.fileFormat(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we need to modify this?

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

@ranxianglei
Copy link
Contributor

extends Factory is more batter

Zouxxyy pushed a commit to Zouxxyy/incubator-paimon that referenced this pull request Jan 3, 2025
@ranxianglei
Copy link
Contributor

This pr is from my pr #4497 , You spared me a private discussion and plagiarized my PR. Without my consent, you quickly merged the PR and then closed my original PR at the same time.
Then tell me the conclusion of your discussion in this pr #4813

Why do this? Do you follow the Apache open source spirit? stop your mistakes please @JingsongLi @leaves12138

@JingsongLi
Copy link
Contributor

@ranxianglei
As your said, the solution is different, and the idea is from me, and you also said that the performance test performed worse, and no updates more than a month.
This PR is very reasonable.

@JingsongLi
Copy link
Contributor

JingsongLi commented Jan 8, 2025

@ranxianglei Even in #4813 , you have never provided a better version or convincing reasons.

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