Yash-cor commented on code in PR #34163:
URL: https://github.com/apache/shardingsphere/pull/34163#discussion_r1899946218
##########
infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/with/WithSegmentBinder.java:
##########
@@ -61,12 +63,18 @@ public static WithSegment bind(final WithSegment segment,
final SQLStatementBind
for (CommonTableExpressionSegment each :
segment.getCommonTableExpressions()) {
CommonTableExpressionSegment boundCommonTableExpression =
CommonTableExpressionSegmentBinder.bind(each, binderContext,
segment.isRecursive());
boundCommonTableExpressions.add(boundCommonTableExpression);
+ if (each.getAliasName().isPresent()) {
+
ShardingSpherePreconditions.checkNotContains(binderContext.getCommonTableExpressionsSegmentsUniqueAliases(),
each.getAliasName(),
+ () -> new
UniqueCommonTableExpressionException(each.getAliasName().get()));
+
binderContext.getCommonTableExpressionsSegmentsUniqueAliases().add(new
CaseInsensitiveString(each.getAliasName().get()));
+ }
if (segment.isRecursive() && each.getAliasName().isPresent()) {
externalTableBinderContexts.removeAll(new
CaseInsensitiveString(each.getAliasName().get()));
}
bindWithColumns(each.getColumns(), boundCommonTableExpression);
each.getAliasName().ifPresent(optional ->
externalTableBinderContexts.put(new CaseInsensitiveString(optional),
createWithTableBinderContext(boundCommonTableExpression)));
}
+
Review Comment:
Yeah
--
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]