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

[#1661] feat(core): introduce catalog capability framework #2819

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

mchades
Copy link
Contributor

@mchades mchades commented Apr 7, 2024

What changes were proposed in this pull request?

  1. Introduce catalog capability framework
  2. Support column not null capability to show how the framework works

Why are the changes needed?

Improving code quality

Fix: #1662

Does this PR introduce any user-facing change?

no

How was this patch tested?

existing tests

@mchades mchades force-pushed the issue-1661 branch 2 times, most recently from 0bc6e19 to 695e959 Compare April 8, 2024 16:01
@mchades mchades marked this pull request as ready for review April 8, 2024 16:02
@mchades mchades requested review from jerryshao and diqiu50 April 8, 2024 16:02
@mchades mchades self-assigned this Apr 8, 2024
@mchades
Copy link
Contributor Author

mchades commented Apr 10, 2024

Could you please help review it, thanks! @jerryshao @diqiu50

@mchades mchades requested review from yuqi1129 and FANNG1 April 12, 2024 05:18
* some special capabilities, it should override the default implementation of the capabilities.
*/
@Evolving
public interface HasCapabilities {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the name HasCapabilities is not so proper here. I would call it Capability.

If you want to define a HasCapabilities interface? It should be like:

interface HasCapabilities {
  Capability[] hasCapabilies()
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

* @return A new instance of HasCapabilities.
*/
@Evolving
protected HasCapabilities newCaps() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't suggest use the abbreviation "caps" here, it is not a common abbreviation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed

TABLE,
COLUMN,
FILESET
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you also add messaging and partition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added


public class CapabilityHelpers {

public static Column[] applyCapabilities(Column[] columns, Capability capabilities) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It is just one capability, why do you need to use plural?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method will apply multiple capabilities to the column, such as default value, not null, case sensitivity, and so on. Therefore I use plural

Column appliedColumn =
applyCapabilities(
Column.of(
addColumn.fieldName()[0],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why getting the first element of the fieldName?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because the first name is the column name, and the others are just nested fields in columns.

@jerryshao jerryshao merged commit 8fd412c into apache:main Apr 15, 2024
22 checks passed
@mchades mchades mentioned this pull request Apr 15, 2024
6 tasks
@mchades mchades deleted the issue-1661 branch November 22, 2024 03:39
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.

2 participants