You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "yuxiqian (via GitHub)" <gi...@apache.org> on 2024/08/19 15:20:37 UTC
[PR] [FLINK-36092] Let schema evolve work with transform [flink-cdc]
yuxiqian opened a new pull request, #3557:
URL: https://github.com/apache/flink-cdc/pull/3557
Currently, transform doesn't work very well with schema evolution.
The main issue is that TransformOperator (including Pre- and Post-) simply passes all upstream schema change events to downstream, which isn't correct under most cases.
Here's corresponding operations this PR tries to do in various transform rule definitions:
| | `*, ...` | `..., *, ...` | `..., *` | No asterisk |
|----------------------|------------------------------------------------------------------|-------------------------------------------------|------------------------------------------|---------------------------------------------|
| AddColumnEvent | Yes, but LAST position needs position reordering (LAST -> AFTER) | Yes, but FIRST / LAST position needs reordering | Yes, but FIRST position needs reordering | No |
| AlterColumnTypeEvent | Yes | Yes | Yes | Yes if that column was referenced |
| RenameColumnEvent | Yes | Yes | Yes | No, exception if that column was referenced |
| DropColumnEvent | Yes | Yes | Yes | No, exception if that column was referenced |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36092] Fix schema evolution with wildcarded transform rules [flink-cdc]
Posted by "leonardBang (via GitHub)" <gi...@apache.org>.
leonardBang merged PR #3557:
URL: https://github.com/apache/flink-cdc/pull/3557
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36092] Let schema evolve work with transform [flink-cdc]
Posted by "leonardBang (via GitHub)" <gi...@apache.org>.
leonardBang commented on code in PR #3557:
URL: https://github.com/apache/flink-cdc/pull/3557#discussion_r1723178889
##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/TransformParser.java:
##########
@@ -585,4 +590,95 @@ public static String normalizeFilter(String projection, String filter) {
return filter;
}
}
+
+ public static boolean hasAsterisk(@Nullable String projection) {
+ if (isNullOrWhitespaceOnly(projection)) {
+ return false;
+ }
+ return parseProjectionExpression(projection).getOperandList().stream()
+ .anyMatch(TransformParser::hasAsterisk);
+ }
+
+ private static boolean hasAsterisk(SqlNode sqlNode) {
+ if (sqlNode instanceof SqlIdentifier) {
+ return ((SqlIdentifier) sqlNode).isStar();
+ } else if (sqlNode instanceof SqlBasicCall) {
+ SqlBasicCall sqlBasicCall = (SqlBasicCall) sqlNode;
+ return sqlBasicCall.getOperandList().stream().anyMatch(TransformParser::hasAsterisk);
+ } else if (sqlNode instanceof SqlNodeList) {
+ SqlNodeList sqlNodeList = (SqlNodeList) sqlNode;
+ return sqlNodeList.getList().stream().anyMatch(TransformParser::hasAsterisk);
+ } else {
+ return false;
+ }
+ }
+
+ public static Optional<SchemaChangeEvent> transformSchemaChangeEvent(
Review Comment:
Well, I think the `transformSchemaChangeEvent` method should not stay in the `TransformParser ` class from code design perspective.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36092] Let schema evolve work with transform [flink-cdc]
Posted by "yuxiqian (via GitHub)" <gi...@apache.org>.
yuxiqian commented on PR #3557:
URL: https://github.com/apache/flink-cdc/pull/3557#issuecomment-2296839736
Considering this is blocking users from using schema evolution with transform blocks, could @leonardBang @aiwenmo please take a look?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36092] Fix schema evolution with wildcarded transform rules [flink-cdc]
Posted by "yuxiqian (via GitHub)" <gi...@apache.org>.
yuxiqian commented on PR #3557:
URL: https://github.com/apache/flink-cdc/pull/3557#issuecomment-2304442553
Seems Postgres and OceanBase CI is hanging, unlikely to be relevant to this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36092] Fix schema evolution with wildcarded transform rules [flink-cdc]
Posted by "leonardBang (via GitHub)" <gi...@apache.org>.
leonardBang commented on PR #3557:
URL: https://github.com/apache/flink-cdc/pull/3557#issuecomment-2304243511
@yuxiqian The CI failed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org