Yash-cor commented on code in PR #34384: URL: https://github.com/apache/shardingsphere/pull/34384#discussion_r1924692680
########## infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/with/WithSegmentBinder.java: ########## @@ -71,18 +74,26 @@ public static WithSegment bind(final WithSegment segment, final SQLStatementBind } private static SimpleTableSegmentBinderContext createWithTableBinderContext(final CommonTableExpressionSegment commonTableExpressionSegment) { - return new SimpleTableSegmentBinderContext(commonTableExpressionSegment.getSubquery().getSelect().getProjections().getProjections()); + if (commonTableExpressionSegment.getColumns().isEmpty()) { + return new SimpleTableSegmentBinderContext(commonTableExpressionSegment.getSubquery().getSelect().getProjections().getProjections()); + } else { + Collection<ProjectionSegment> projectionSegments = new LinkedList<>(); + commonTableExpressionSegment.getColumns().forEach(each -> projectionSegments.add(new ColumnProjectionSegment(each))); Review Comment: Along with this should we also move the bindWithColumns to CommonTableExpressionBinder. ########## infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/with/WithSegmentBinder.java: ########## @@ -71,18 +74,26 @@ public static WithSegment bind(final WithSegment segment, final SQLStatementBind } private static SimpleTableSegmentBinderContext createWithTableBinderContext(final CommonTableExpressionSegment commonTableExpressionSegment) { - return new SimpleTableSegmentBinderContext(commonTableExpressionSegment.getSubquery().getSelect().getProjections().getProjections()); + if (commonTableExpressionSegment.getColumns().isEmpty()) { + return new SimpleTableSegmentBinderContext(commonTableExpressionSegment.getSubquery().getSelect().getProjections().getProjections()); + } else { + Collection<ProjectionSegment> projectionSegments = new LinkedList<>(); + commonTableExpressionSegment.getColumns().forEach(each -> projectionSegments.add(new ColumnProjectionSegment(each))); Review Comment: > Can you move this logic to CommonTableExpressionSegmentBinder? Along with this should we also move the bindWithColumns to CommonTableExpressionBinder. -- 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: notifications-unsubscr...@shardingsphere.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org