strongduanmu commented on a change in pull request #6377:
URL: https://github.com/apache/shardingsphere/pull/6377#discussion_r456851487
##########
File path:
shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/statement/dml/InsertStatementContext.java
##########
@@ -78,6 +83,19 @@ public InsertStatementContext(final SchemaMetaData
schemaMetaData, final List<Ob
return result;
}
+ private Optional<InsertSelectContext> getInsertSelectContext(final
SchemaMetaData schemaMetaData, final String sql,
+ final
List<Object> parameters, final AtomicInteger parametersOffset) {
+ if (!getSqlStatement().getInsertSelect().isPresent()) {
+ return Optional.empty();
+ }
+ SubquerySegment insertSelectSegment =
getSqlStatement().getInsertSelect().get();
+ String selectSql = sql.substring(insertSelectSegment.getStartIndex(),
insertSelectSegment.getStopIndex() + 1);
Review comment:
> Since `createProjection` needs `SQL`, here `SQL` is passed and
handled. Maybe we consider parsing `SQL` into `sqlStatement`. It is another
point, we could consider it later.
> If `sqlStatement ` contained the text of `SQL`, we would not need to pass
it through the parameter list.
@tristaZero This suggestion sounds great. In the sql parsing phase, parse
the required sql fragments, which is more elegant than passing parameters. 👍
I will try to use parsing way to remove sql parameters.
----------------------------------------------------------------
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:
[email protected]