sohardforaname commented on code in PR #11035:
URL: https://github.com/apache/doris/pull/11035#discussion_r931994568
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -190,11 +194,39 @@ public LogicalPlan
visitRegularQuerySpecification(RegularQuerySpecificationConte
/**
* Create an aliased table reference. This is typically used in FROM
clauses.
*/
+ private LogicalPlan applyAlias(TableAliasContext ctx, LogicalPlan plan) {
+ if (null != ctx.strictIdentifier()) {
+ String alias = ctx.strictIdentifier().getText();
+ if (null != ctx.identifierList()) {
+ throw new IllegalStateException("Do not implemented");
+ // List<String> colName =
visitIdentifierSeq(ctx.identifierList().identifierSeq());
+ // TODO: multi-colName
+ } else {
+ return new LogicalSubQueryAlias<>(alias, plan);
+ }
+ }
+ return plan;
+ }
+
@Override
public LogicalPlan visitTableName(TableNameContext ctx) {
List<String> tableId =
visitMultipartIdentifier(ctx.multipartIdentifier());
- // TODO: sample and time travel, alias, sub query
- return new UnboundRelation(tableId);
+ return applyAlias(ctx.tableAlias(), new UnboundRelation(tableId));
+ }
+
+ @Override
+ public LogicalPlan visitAliasedQuery(AliasedQueryContext ctx) {
+ String alias = "__auto_generated_name__";
+ LogicalPlan query = visitQuery(ctx.query());
+ if (null != ctx.tableAlias().strictIdentifier()) {
Review Comment:
Yes, I got an error at running query.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]