You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/04/23 11:20:08 UTC

[GitHub] [shardingsphere] terrymanu commented on a change in pull request #10158: fix drop columns exception.

terrymanu commented on a change in pull request #10158:
URL: https://github.com/apache/shardingsphere/pull/10158#discussion_r619142378



##########
File path: shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptAlterTableTokenGenerator.java
##########
@@ -130,7 +130,7 @@ protected boolean isGenerateSQLTokenForEncrypt(final SQLStatementContext sqlStat
     private Collection<SQLToken> getDropColumnTokens(final String tableName, final String columnName, 
                                                      final ColumnSegment columnSegment, final DropColumnDefinitionSegment dropColumnDefinitionSegment) {
         Collection<SQLToken> result = new LinkedList<>();
-        result.add(new RemoveToken(dropColumnDefinitionSegment.getStartIndex() - 1, columnSegment.getStopIndex() + 1));
+        result.add(new RemoveToken(columnSegment.getStartIndex() - "DROP COLUMN".length() - 2, columnSegment.getStopIndex()));

Review comment:
       "DROP COLUMN" is the literal which is incorrect.
   The `drop column` may keep more than one spaces or include comment inside, for example: `drop    /*xxxx*/ column` 




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org