924060929 commented on code in PR #57532:
URL: https://github.com/apache/doris/pull/57532#discussion_r2485262396
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ExpressionAnalyzer.java:
##########
@@ -962,33 +1002,153 @@ private List<Slot> addSqlIndexInfo(List<Slot> slots,
Optional<Pair<Integer, Inte
}
/** bindSlotByScope */
- public List<Slot> bindSlotByScope(UnboundSlot unboundSlot, Scope scope) {
+ public List<Expression> bindSlotByScope(UnboundSlot unboundSlot, Scope
scope) {
List<String> nameParts = unboundSlot.getNameParts();
Optional<Pair<Integer, Integer>> idxInSql =
unboundSlot.getIndexInSqlString();
int namePartSize = nameParts.size();
switch (namePartSize) {
// column
case 1: {
- return addSqlIndexInfo(bindSingleSlotByName(nameParts.get(0),
scope), idxInSql);
+ return (List<Expression>) bindExpressionByColumn(unboundSlot,
nameParts, idxInSql, scope);
}
// table.column
case 2: {
- return addSqlIndexInfo(bindSingleSlotByTable(nameParts.get(0),
nameParts.get(1), scope), idxInSql);
+ return (List<Expression>)
bindExpressionByTableColumn(unboundSlot, nameParts, idxInSql, scope);
}
// db.table.column
case 3: {
- return addSqlIndexInfo(bindSingleSlotByDb(nameParts.get(0),
nameParts.get(1), nameParts.get(2), scope),
- idxInSql);
+ return (List<Expression>)
bindExpressionByDbTableColumn(unboundSlot, nameParts, idxInSql, scope);
}
// catalog.db.table.column
- case 4: {
- return addSqlIndexInfo(bindSingleSlotByCatalog(
- nameParts.get(0), nameParts.get(1), nameParts.get(2),
nameParts.get(3), scope), idxInSql);
- }
default: {
- throw new AnalysisException("Not supported name: " +
StringUtils.join(nameParts, "."));
+ return (List<Expression>)
bindExpressionByCatalogDbTableColumn(unboundSlot, nameParts, idxInSql, scope);
+ }
+ }
+ }
+
+ private List<? extends Expression> bindExpressionByCatalogDbTableColumn(
Review Comment:
this binding priority compatible with original binding logic, test by
`test_db_name_ignore_cluster.groovy`, and new binding logic test by
`test_dereference.groovy`
--
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]