Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](planner) fix bug of select stmt toSql #37274

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ public void analyze(Analyzer analyzer) throws UserException {
// remove excepted columns
resultExprs.removeIf(expr -> exceptCols.contains(expr.toColumnLabel()));
colLabels.removeIf(exceptCols::contains);
originalExpr = new ArrayList<>(resultExprs);
} else {
if (needToSql) {
originalExpr = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
4 6
6 6

-- !test_select_star_except_sql --
v_mal_old_create_view CREATE VIEW `v_mal_old_create_view` AS SELECT `regression_test_view_p0`.`mal_old_create_view`.`pk` AS `pk`, `regression_test_view_p0`.`mal_old_create_view`.`b` AS `b` FROM `regression_test_view_p0`.`mal_old_create_view`; utf8mb4 utf8mb4_0900_bin

-- !test_sql --
v_mal_old_create_view2 CREATE VIEW `v_mal_old_create_view2` AS select cast(cast(a as string) as time) from `internal`.`regression_test_view_p0`.`mal_old_create_view`; utf8mb4 utf8mb4_0900_bin
v_mal_old_create_view2 CREATE VIEW `v_mal_old_create_view2` AS SELECT CAST(CAST(`a` AS TEXT) AS TIME(0)) AS `__cast_expr_0` FROM `regression_test_view_p0`.`mal_old_create_view`; utf8mb4 utf8mb4_0900_bin

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// under the License.

suite("create_view_star_except_and_cast_to_sql") {

sql "SET enable_nereids_planner=false;"
sql """
DROP TABLE IF EXISTS mal_old_create_view
"""
Expand All @@ -34,6 +34,7 @@ suite("create_view_star_except_and_cast_to_sql") {
sql "create view v_mal_old_create_view as select * except(a) from mal_old_create_view"

qt_test_select_star_except "select * from v_mal_old_create_view order by pk,b"
qt_test_select_star_except_sql "show create view v_mal_old_create_view"

sql "drop view if EXISTS v_mal_old_create_view2"

Expand Down
Loading