morrySnow commented on code in PR #23121:
URL: https://github.com/apache/doris/pull/23121#discussion_r1326954370
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -731,6 +734,18 @@ public LogicalPlan
visitRegularQuerySpecification(RegularQuerySpecificationConte
});
}
+ @Override
+ public LogicalPlan visitInlineTable(InlineTableContext ctx) {
+ List<UnboundOneRowRelation> exprsList = ctx.rowConstructor().stream()
+ .map(this::visitRowConstructor)
+ .collect(ImmutableList.toImmutableList());
+ LogicalPlan relation = exprsList.get(0);
+ for (int i = 1; i < exprsList.size(); i++) {
+ relation = new LogicalUnion(Qualifier.ALL,
ImmutableList.of(relation, exprsList.get(i)));
+ }
Review Comment:
u could not construct a multi children union in parser. because the rules
before merge set oepration only could process union with two children
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java:
##########
@@ -140,13 +147,28 @@ public List<Rule> buildRules() {
column.getName()
));
} else {
-
columnToOutput.put(column.getName(),
- new
Alias(Literal.of(column.getDefaultValue())
-
.checkedCastTo(DataType.fromCatalogType(column.getType())),
- column.getName()));
+ if (column.getDefaultValueExpr()
== null) {
+
columnToOutput.put(column.getName(),
+ new
Alias(Literal.of(column.getDefaultValue())
+ .checkedCastTo(
+
DataType.fromCatalogType(column.getType())),
+
column.getName()));
+ } else {
+ Expression
defualtValueExpression = FunctionBinder.INSTANCE.rewrite(
Review Comment:
add comment to explain which scene getDefaultValueExpr is null, and which is
not null
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java:
##########
@@ -140,13 +147,28 @@ public List<Rule> buildRules() {
column.getName()
));
} else {
-
columnToOutput.put(column.getName(),
- new
Alias(Literal.of(column.getDefaultValue())
-
.checkedCastTo(DataType.fromCatalogType(column.getType())),
- column.getName()));
+ if (column.getDefaultValueExpr()
== null) {
+
columnToOutput.put(column.getName(),
+ new
Alias(Literal.of(column.getDefaultValue())
+ .checkedCastTo(
+
DataType.fromCatalogType(column.getType())),
+
column.getName()));
+ } else {
+ Expression
defualtValueExpression = FunctionBinder.INSTANCE.rewrite(
+ new
NereidsParser().parseExpression(
+
column.getDefaultValueExpr().toSql()),
+ new
ExpressionRewriteContext(ctx.cascadesContext));
+ NamedExpression slot =
defualtValueExpression instanceof NamedExpression
+ ? ((NamedExpression)
defualtValueExpression)
+ : new
Alias(defualtValueExpression);
+
+
columnToOutput.put(column.getName(), slot);
+ }
}
}
}
+ } catch (Exception e) {
+ throw new AnalysisException(e.getMessage(),
e.getCause());
Review Comment:
do not add catch here, only try catch in the smallest scope
--
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]