Skip to content

Commit

Permalink
use original string to detect duplicate
Browse files Browse the repository at this point in the history
Signed-off-by: AilinKid <314806019@qq.com>
  • Loading branch information
AilinKid committed May 25, 2022
1 parent db2b48c commit 52ef358
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3844,6 +3844,10 @@ func (b *PlanBuilder) buildSelect(ctx context.Context, sel *ast.SelectStmt) (p L
}
}

if strings.HasPrefix(b.ctx.GetSessionVars().StmtCtx.OriginalSQL, "SELECT LAST_VALUE((SELECT upper.j FROM t LIMIT 1)) OVER (PARTITION BY i) FROM t AS upper") {
fmt.Println(1)
}

hasWindowFuncField := b.detectSelectWindow(sel)
// Some SQL statements define WINDOW but do not use them. But we also need to check the window specification list.
// For example: select id from t group by id WINDOW w AS (ORDER BY uids DESC) ORDER BY id;
Expand Down
2 changes: 1 addition & 1 deletion planner/core/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ func isTableAliasDuplicate(ctx sessionctx.Context, node ast.ResultSetNode, table
}
}
}
_, exists := tableAliases[tabName.L]
_, exists := tableAliases[tabName.O]
if len(tabName.L) != 0 && exists {
names := strings.Split(tabName.O, ".")
return ErrNonUniqTable.GenWithStackByArgs(names[len(names)-1])
Expand Down

0 comments on commit 52ef358

Please sign in to comment.