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

[Improvement] In HadoopCatalogOperations.java incorrect use of static field #2188

Closed
justinmclean opened this issue Feb 13, 2024 · 3 comments · Fixed by #2336
Closed

[Improvement] In HadoopCatalogOperations.java incorrect use of static field #2188

justinmclean opened this issue Feb 13, 2024 · 3 comments · Fixed by #2336
Labels
good first issue Good for newcomers improvement Improvements on everything

Comments

@justinmclean
Copy link
Member

What would you like to be improved?

In HadoopCatalogOperations.java GRAVITINO_MANAGED_ENTITY in not a static field, it belongs to it's parent.

 .put(HadoopSchemaPropertiesMetadata.GRAVITINO_MANAGED_ENTITY, Boolean.TRUE.toString())

How should we improve?

Reference GRAVITINO_MANAGED_ENTITY correctly using the parent class.

@justinmclean justinmclean added good first issue Good for newcomers improvement Improvements on everything labels Feb 13, 2024
@YxAc
Copy link
Contributor

YxAc commented Feb 24, 2024

hi @justinmclean , GRAVITINO_MANAGED_ENTITY is a static field of the parent class, and It is legal to access the static member of the parent class through the subclass name. So I think it's not a problem.

@justinmclean
Copy link
Member Author

While this is a minor issue and while It is legal it is not best practice. Static members are associated with the class itself, not with any of its child classes. Accessing it via the wrong method possible suggests a misunderstanding of how OO works. It is best practice to use the base class for clarity.

@YxAc
Copy link
Contributor

YxAc commented Feb 25, 2024

While this is a minor issue and while It is legal it is not best practice. Static members are associated with the class itself, not with any of its child classes. Accessing it via the wrong method possible suggests a misunderstanding of how OO works. It is best practice to use the base class for clarity.

Got it and Agree. I'll fix this.

justinmclean pushed a commit that referenced this issue Feb 26, 2024
…or HadoopCatalogOperations (#2336)

### What changes were proposed in this pull request?
- fix incorrect static field reference for HadoopCatalogOperations

### Why are the changes needed?
Fix: #2188 

### Does this PR introduce _any_ user-facing change?
N/A

### How was this patch tested?
No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers improvement Improvements on everything
Projects
None yet
2 participants