Skip to content

[#7206] improvement(javadoc): Fix Javadoc warnings in Trino connector module #7317

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

Merged
merged 4 commits into from
Jun 26, 2025

Conversation

KyleLin0927
Copy link
Contributor

@KyleLin0927 KyleLin0927 commented Jun 1, 2025

What changes were proposed in this pull request?

Fix the Javadoc in Trino connector module.

Why are the changes needed?

Fixes #7206

Does this PR introduce any user-facing change?

No.

How was this patch tested?

  • Ran ./gradlew trino-connector:trino-connector:javadoc to confirm the Javadoc warning was resolved.
  • Ran ./gradlew clean build to ensure the build passes without errors.

@KyleLin0927
Copy link
Contributor Author

Hi, @justinmclean ,

about #7206, It might be because the Trino connector is compiled using JDK 17, which results in stricter Javadoc checks compared to the Spark connector and other Trino connectors.

As a result, almost all Trino connector modules have added Javadoc comments to their code. If you prefer not to make major modifications to the files, we might need to explore alternative adjustments. I’ve submitted a draft for your reference, if everything looks good to you, I’ll go ahead and create a formal PR.

@KyleLin0927 KyleLin0927 marked this pull request as ready for review June 9, 2025 04:56
@KyleLin0927
Copy link
Contributor Author

@justinmclean I have released the PR, plz take a look, thanks.

@jerryshao jerryshao requested review from yuqi1129 and diqiu50 and removed request for yuqi1129 June 9, 2025 20:53
@jerryshao
Copy link
Contributor

@yuqi1129 @diqiu50 can you please help to review this PR?

public static final String GRAVITINO_DYNAMIC_CONNECTOR = "__gravitino.dynamic.connector";
/** The Gravitino dynamic connector catalog config. */
public static final String GRAVITINO_DYNAMIC_CONNECTOR_CATALOG_CONFIG =
"__gravitino.dynamic.connector.catalog.config";
Copy link
Member

@justinmclean justinmclean Jun 10, 2025

Choose a reason for hiding this comment

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

Same with this set of comments above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ve checked these are indeed required to prevent warning messages.

public static final String TRINO_CATALOG_STORE = "catalog.store";
/** The Trino catalog management. */
public static final String TRINO_CATALOG_MANAGEMENT = "catalog.management";
Copy link
Member

Choose a reason for hiding this comment

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

The above comments are not really needed. There is little point in adding a comment that merely reproduces what the code states.

Copy link
Member

@justinmclean justinmclean Jun 10, 2025

Choose a reason for hiding this comment

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

However, if they are required by Javadocs to remove warnings, then that's okay - the same applies to my other comments below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ve double-checked. these Javadocs are indeed required to prevent warning messages.

final String defaultValue;

/** Whether this configuration parameter is required */
final boolean isRequired;
Copy link
Member

Choose a reason for hiding this comment

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

Again, I'm not sure these comments add any value. Also, why "configuration parameter" when the class is not called that? The distinction between a parameter and an entry may be subtle, but it is nonetheless distinct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ve checked these annotations and found they are unnecessary, so I’ll remove them.”

*
* @param connectorName the name of the connector
* @param config the config of the connector
* @param context the context of the connector
Copy link
Member

Choose a reason for hiding this comment

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

These comments could be improved a little. i.e config -> configuration, and I'm not sure "of the connector" works for the second two parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

GRAVITINO_DUPLICATED_CATALOGS(24, EXTERNAL),
/** Expression error. */
GRAVITINO_EXPRESSION_ERROR(25, EXTERNAL);
Copy link
Member

Choose a reason for hiding this comment

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

These comments add little value and make the code harder to read and maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

those comments help remove the warnings.

protected final List<PropertyMetadata<?>> columnProperties;

/** The data type transformer used to convert between Gravitino and Trino types. */
protected final GeneralDataTypeTransformer dataTypeTransformer;
Copy link
Member

Choose a reason for hiding this comment

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

I'd remove the comments above they don't really add any value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ve double-checked. these Javadocs are indeed required to prevent warning messages.

@@ -28,6 +28,7 @@
/** Convert Apache Hive properties between Trino and Apache Gravitino. */
public class HiveCatalogPropertyConverter extends PropertyConverter {

/** Logger for the HiveCatalogPropertyConverter class. */
public static final Logger LOG = LoggerFactory.getLogger(HiveCatalogPropertyConverter.class);
Copy link
Member

Choose a reason for hiding this comment

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

There is no need for this comment or, in fact, any similar comments. Comments should a) describe why design decisions were taken b) explain complex code or c) exist to generate Javadocs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

those comments are required for removing the warning, and I will modify the description.

Copy link
Contributor

@diqiu50 diqiu50 Jun 20, 2025

Choose a reason for hiding this comment

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

Make the LOG private and remove the comments

*
* @param transforms the array of transforms
* @return the list of partition fields
*/
Copy link
Member

Choose a reason for hiding this comment

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

While this is correct, it might be better to mention expressions here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

*
* @param partitions the list of partition fields
* @return the array of transforms
*/
Copy link
Member

Choose a reason for hiding this comment

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

While this is correct, it might be better to mention expressions here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

*
* @param orderFields the list of sort order fields
* @return the array of sort orders
*/
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem to agree with the name of the function. Is the function poorly named or do the comments need updating?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the issue is that the function name is not precise. If needed, I can open another PR to fix the name and its unit tests, or if you prefer, I can make the changes directly in this PR.

@justinmclean
Copy link
Member

@KyleLin0927 This looks good to me. There are a couple of minor comments/things to fix. I had thought at first that you may have added extra unnecessary comments in a couple of places, but it may be that the Javadocs warnings are generated there, if so, please ignore/those comments of mine.

@KyleLin0927
Copy link
Contributor Author

@KyleLin0927 This looks good to me. There are a couple of minor comments/things to fix. I had thought at first that you may have added extra unnecessary comments in a couple of places, but it may be that the Javadocs warnings are generated there, if so, please ignore/those comments of mine.

thanks for your review, I will double check your comment later.

*
* @param region the region to check
* @return true if the catalog is in the same region as the specified region, false otherwise
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

This may not be related to this PR

public boolean isSameRegion(String region) {
    // When the Gravitino connector has not configured the cloud.region-code,
    // or the catalog has not configured the cloud.region-code,
    // or the catalog cluster name is equal to the connector-configured region code,
    // the catalog is belong to the region
    return StringUtils.isEmpty(region)
        || StringUtils.isEmpty(getRegion())
        || region.equals(getRegion());
  }

Judging from the code above, it seems that as long as the parameter region is not empty, the result is always true. @diqiu50 Please help to confirm this point.

Copy link
Contributor

Choose a reason for hiding this comment

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

That’s incorrect — the result is always true even when the region parameter is empty.

@@ -26,21 +26,38 @@
/** Interface for adding property metadata to the catalogs */
public interface HasPropertyMeta {

/** Property metadata for schema */
/**
* Gets the property metadata for schemas.
Copy link
Contributor

Choose a reason for hiding this comment

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

Get the property metadata for a specific schema.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@KyleLin0927
Copy link
Contributor Author

@justinmclean Thank you for reviewing. I’ve double-checked the mentioned code, removed unnecessary logic, and updated the wording.

protected final HashMap<String, CatalogConnectorContext.Builder> catalogBuilders =
new HashMap<>();

/** The region code where this catalog connector factory is running */
Copy link
Contributor

Choose a reason for hiding this comment

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

The region code indicates the location of this Trino instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@diqiu50 diqiu50 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@justinmclean justinmclean left a comment

Choose a reason for hiding this comment

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

LGTM thanks for doing this

@justinmclean justinmclean merged commit 1cc02e6 into apache:main Jun 26, 2025
27 checks passed
Abyss-lord pushed a commit to Abyss-lord/gravitino that referenced this pull request Jun 27, 2025
…nector module (apache#7317)

### What changes were proposed in this pull request?

Fix the Javadoc in Trino connector module.

### Why are the changes needed?

Fixes apache#7206

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?

- Ran `./gradlew trino-connector:trino-connector:javadoc` to confirm the
Javadoc warning was resolved.
- Ran `./gradlew clean build` to ensure the build passes without errors.
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.

[Improvement] Fix JavaDoc issues in task :trino-connector:trino-connector:javadoc
5 participants