tuichenchuxin commented on a change in pull request #14006:
URL: https://github.com/apache/shardingsphere/pull/14006#discussion_r772893004
##########
File path:
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptProjectionTokenGenerator.java
##########
@@ -146,15 +146,22 @@ private ColumnProjection buildColumnProjection(final
ColumnProjectionSegment seg
private Collection<ColumnProjection> generateProjections(final String
tableName, final ColumnProjection column, final SubqueryType subqueryType,
final boolean shorthand) {
Collection<ColumnProjection> result = new LinkedList<>();
if (SubqueryType.PREDICATE_SUBQUERY.equals(subqueryType)) {
- result.add(generatePredicateSubqueryProjection(tableName, column));
+
result.add(distinctOwner(generatePredicateSubqueryProjection(tableName,
column), shorthand));
} else if (SubqueryType.TABLE_SUBQUERY.equals(subqueryType)) {
- result.addAll(generateTableSubqueryProjections(tableName, column));
+ result.addAll(generateTableSubqueryProjections(tableName, column,
shorthand));
} else {
- result.add(generateCommonProjection(tableName, column, shorthand));
+ result.add(distinctOwner(generateCommonProjection(tableName,
column, shorthand), shorthand));
}
return result;
}
+ private ColumnProjection distinctOwner(final ColumnProjection column,
final boolean shorthand) {
+ if (shorthand || null == column.getOwner()) {
Review comment:
column.getOwner() can delete.
##########
File path:
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptProjectionTokenGenerator.java
##########
@@ -117,7 +117,7 @@ private SubstitutableColumnNameToken
generateSQLTokens(final ShorthandProjection
previousSQLTokens.removeIf(each -> each.getStartIndex() ==
segment.getStartIndex());
return new SubstitutableColumnNameToken(segment.getStartIndex(),
segment.getStopIndex(), projections, databaseType.getQuoteCharacter());
}
-
Review comment:
Code style should be same.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]