-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Feature] Support config column/primaryKey/constraintKey in schema #5564
Conversation
9715f38
to
a6d35a8
Compare
a6d35a8
to
2e595a0
Compare
f0b787c
to
2b296e2
Compare
docs/en/concept/schema-feature.md
Outdated
|:---------------|:------------| | ||
| KEY | key | | ||
| UNIQUE_KEY | unique key | | ||
| FOREIGN_KEY | foreign key | |
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.
How to use FOREIGN_KEY
in SeaTunnel? Seem like never use it now?
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.
In fact, we don't support foreign keys!
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.
So I think we should remove it?
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.
OK, I will remove this until we support it in the future
docs/en/concept/schema-feature.md
Outdated
|
||
| ConstraintType | Description | | ||
|:---------------|:------------| | ||
| KEY | key | |
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.
What's KEY
means?
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.
KEY means the index in schema, I am not clear if we need to rename it to index, since in the backend code it is KEY.
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.
how about INDEX_KEY
?
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.
Yes, use INDEX_KEY is better
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/CatalogTableUtil.java
Outdated
Show resolved
Hide resolved
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/CatalogTableUtil.java
Outdated
Show resolved
Hide resolved
...el-api/src/main/java/org/apache/seatunnel/api/table/catalog/schema/ReadonlyConfigParser.java
Show resolved
Hide resolved
seatunnel-api/src/test/java/org/apache/seatunnel/api/table/catalog/CatalogTableUtilTest.java
Outdated
Show resolved
Hide resolved
seatunnel-api/src/test/java/org/apache/seatunnel/api/table/catalog/CatalogTableUtilTest.java
Outdated
Show resolved
Hide resolved
...c/test/java/org/apache/seatunnel/connectors/seatunnel/fake/source/FakeDataGeneratorTest.java
Outdated
Show resolved
Hide resolved
seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/JsonUtils.java
Outdated
Show resolved
Hide resolved
70682c7
to
640c451
Compare
docs/en/concept/schema-feature.md
Outdated
|:---------------|:------------| | ||
| KEY | key | | ||
| UNIQUE_KEY | unique key | | ||
| FOREIGN_KEY | foreign key | |
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.
So I think we should remove it?
docs/en/concept/schema-feature.md
Outdated
|
||
| ConstraintType | Description | | ||
|:---------------|:------------| | ||
| KEY | key | |
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.
how about INDEX_KEY
?
@Deprecated | ||
public static final Option<Map<String, String>> 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.
Can we just delete it now? Since it just be used in internal code.
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.
Yes, we can
// Use TableSchemaOptions.FieldOptions.FIELDS instead | ||
@Deprecated | ||
public static final Option<Map<String, Object>> FIELDS = | ||
Options.key("schema.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.
ditto
Any demo we can directly run? I find we add this new feature but we don't have any e2e demo to prove it worked. |
I will add e2e after #5562 merged, right now the CatalogTable cannot transport from source to post task. |
b80fd3f
to
b08f83a
Compare
a621ba9
to
af7e2d7
Compare
af7e2d7
to
da21881
Compare
da21881
to
cb7a606
Compare
cb7a606
to
d300a88
Compare
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
implements TableSchemaParser.ConstraintKeyParser<ReadonlyConfig> { | ||
|
||
@Override | ||
public List<ConstraintKey> parse(ReadonlyConfig schemaConfig) { |
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 lambda is less readable
() -> | ||
new IllegalArgumentException( | ||
"schema.constraintKeys.* config need option [constraintType], please correct your config first")); | ||
List<ConstraintKey.ConstraintKeyColumn> columns = |
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.
lambda is less readable
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.
After ReadonlyConfig refactor, we may support get object from ReadonlyConfig or do this check in a better way.
Purpose of this pull request
Add some options in the schema used to define the whole TableSchema.
Does this PR introduce any user-facing change?
Yes, but this is compatibility with the history version.
How was this patch tested?
Check list
New License Guide
release-note
.