-
Notifications
You must be signed in to change notification settings - Fork 514
[#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
Conversation
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. |
@justinmclean I have released the PR, plz take a look, thanks. |
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"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 | ||
*/ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 | ||
*/ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 | ||
*/ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@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 | ||
*/ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@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 */ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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
…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.
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?
./gradlew trino-connector:trino-connector:javadoc
to confirm the Javadoc warning was resolved../gradlew clean build
to ensure the build passes without errors.