starocean999 commented on code in PR #49118: URL: https://github.com/apache/doris/pull/49118#discussion_r2059652836
########## fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java: ########## @@ -6638,6 +6642,70 @@ public LogicalPlan visitAlterColumnStats(DorisParser.AlterColumnStatsContext ctx } @Override + public List<ChannelDescription> visitChannelDescriptions(DorisParser.ChannelDescriptionsContext ctx) { + List<ChannelDescription> channelDescriptions = new ArrayList<>(); + for (DorisParser.ChannelDescriptionContext channelDescriptionContext : ctx.channelDescription()) { + List<String> soureParts = visitMultipartIdentifier(channelDescriptionContext.source); + if (soureParts.size() != 2) { + throw new ParseException("only support mysql_db.src_tbl", channelDescriptionContext.source); + } + TableNameInfo srcTableInfo = new TableNameInfo(soureParts); + + List<String> targetParts = visitMultipartIdentifier(channelDescriptionContext.destination); + if (targetParts.isEmpty()) { + throw new ParseException("contains at least one target table", channelDescriptionContext.destination); + } + TableNameInfo targetTableInfo = new TableNameInfo(targetParts); + + PartitionNames partitionNames = null; + if (channelDescriptionContext.partitionSpec() != null) { + Pair<Boolean, List<String>> partitionSpec = + visitPartitionSpec(channelDescriptionContext.partitionSpec()); + partitionNames = new PartitionNames(partitionSpec.first, partitionSpec.second); + } + + List<String> columns; + if (channelDescriptionContext.columnList != null) { + columns = visitIdentifierList(channelDescriptionContext.columnList); + } else { + columns = ImmutableList.of(); + } + + ChannelDescription channelDescription = new ChannelDescription( + srcTableInfo.getDb(), + srcTableInfo.getTbl(), + targetTableInfo.getTbl(), + partitionNames, + columns + ); + channelDescriptions.add(channelDescription); + } + return channelDescriptions; + } + + @Override + public LogicalPlan visitCreateDataSyncJob(DorisParser.CreateDataSyncJobContext ctx) { + List<ChannelDescription> channelDescriptions = visitChannelDescriptions(ctx.channelDescriptions()); + List<String> labelParts = visitMultipartIdentifier(ctx.multipartIdentifier()); + int size = labelParts.size(); + String jobName = labelParts.get(size - 1); + String dbName = null; + if (size >= 2) { Review Comment: ```suggestion if (size == 1) { ... } else if (size == 2) { ... } else { throw new ParseException("only support mysql_db.src_tbl", ctx.multipartIdentifier()); } ``` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org