Flink 1.17: Support alter table column#7628
Conversation
d4d75bc to
fe3521b
Compare
fe3521b to
2264787
Compare
|
For backward-compatibility, I'm currently remaining the old alterTable API as it is. Not sure if it's the right thing to do. |
chenjunjiedada
left a comment
There was a problem hiding this comment.
+1. @stevenzwu you may also be interested in this.
|
@chenjunjiedada Thanks for reviewing! I just fixed a bug on modifying the nullability of columns. You might want to check. |
| pendingUpdate.deleteColumn(dropColumn.getColumnName()); | ||
|
|
||
| } else if (change instanceof TableChange.AddWatermark) { | ||
| throw new UnsupportedOperationException("Adding watermark specs is not supported yet. "); |
There was a problem hiding this comment.
nit: empty space in the end is not necessary. please check all places
There was a problem hiding this comment.
this (the extra whitespace in the end) needs to be addressed.
There was a problem hiding this comment.
also the error msg doesn't follow the coding style. you can referring to ArrowVectorAccessor for examples. Please review all the error msgs in this class
E.g., it could be sth like Unsupported schema change: adding watermark specs
| if (!schemaChanges.isEmpty()) { | ||
| UpdateSchema updateSchema = transaction.updateSchema(); | ||
| FlinkAlterTableUtil.applySchemaChanges(updateSchema, schemaChanges); | ||
| updateSchema.commit(); |
There was a problem hiding this comment.
maybe commit action can be moved inside FlinkAlterTableUtil? then it would be more natural to move applyManageSnapshots into FlinkAlterTableUtil too as mentioned in a comment below.
There was a problem hiding this comment.
That's reasonable.
| throw new UnsupportedOperationException("Modifying watermark specs is not supported yet. "); | ||
|
|
||
| } else if (change instanceof TableChange.DropWatermark) { | ||
| throw new UnsupportedOperationException("Watermark specs is not supported yet. "); |
There was a problem hiding this comment.
nit: the previous exception message indicated the action to be taken, such as add, modify, but there is no. Should unify it?
There was a problem hiding this comment.
Thanks for catching this!
| } | ||
|
|
||
| @Test | ||
| public void testAlterTableAddColumn() { |
There was a problem hiding this comment.
Do we need to add a case to test when the name of the field to be added already exists?
|
@stevenzwu @hililiwei Thanks for reviewing! I added a few patches. Could you take a look? |
|
Hi @stevenzwu @hililiwei, do you have any more comments on this? |
stevenzwu
left a comment
There was a problem hiding this comment.
@linyanghao this looks very close to me. just left some minor/nit comments
|
@stevenzwu I addressed the comments. Regarding the warning message, I modified it so that users will only see it when they try altering schema using the old API. Could you take a look? Thanks! |
| pendingUpdate.deleteColumn(dropColumn.getColumnName()); | ||
|
|
||
| } else if (change instanceof TableChange.AddWatermark) { | ||
| throw new UnsupportedOperationException("Adding watermark specs is not supported yet. "); |
There was a problem hiding this comment.
this (the extra whitespace in the end) needs to be addressed.
| pendingUpdate.deleteColumn(dropColumn.getColumnName()); | ||
|
|
||
| } else if (change instanceof TableChange.AddWatermark) { | ||
| throw new UnsupportedOperationException("Adding watermark specs is not supported yet. "); |
There was a problem hiding this comment.
also the error msg doesn't follow the coding style. you can referring to ArrowVectorAccessor for examples. Please review all the error msgs in this class
E.g., it could be sth like Unsupported schema change: adding watermark specs
|
@linyanghao I left a few comments. can you also rebase? |
b017a5c to
bac300d
Compare
|
@stevenzwu Hi, I rebased and addressed the style issues you mentioned. Could you check? |
|
thanks @linyanghao for the contribution and @chenjunjiedada and @hililiwei for the review. @linyanghao can you create a back port PR? you can follow the example here for back port: #8228 |
|
@stevenzwu Sure. Thanks for reviewing! Also thanks @chenjunjiedada and @hililiwei for reviewing! |
|
@stevenzwu Wait, Flink does not support ALTER TABLE in 1.16 yet. I guess we don't need to backport? |
|
if that's the case, yeah no need to back port |
Resolves #7312