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](view) The parameter positions of timestamp diff function to sql are reversed #23601

Merged
merged 1 commit into from
Aug 29, 2023
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 @@ -557,8 +557,8 @@ private String paramsToSql() {
|| fnName.getFunction().equalsIgnoreCase("hours_diff")
|| fnName.getFunction().equalsIgnoreCase("minutes_diff")
|| fnName.getFunction().equalsIgnoreCase("seconds_diff")) {
sb.append(children.get(1).toSql()).append(", ");
sb.append(children.get(0).toSql()).append(")");
sb.append(children.get(0).toSql()).append(", ");
sb.append(children.get(1).toSql()).append(")");
return sb.toString();
}
// used by nereids END
Expand Down
3 changes: 3 additions & 0 deletions regression-test/data/view_p0/view_p0.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
1 2023-08-01 DORID_FIELD1 DORID_FIELD2 ["cat", "dog"] cat
1 2023-08-01 DORID_FIELD1 DORID_FIELD2 ["cat", "dog"] dog

-- !sql --
960

10 changes: 10 additions & 0 deletions regression-test/suites/view_p0/view_p0.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,15 @@ suite("view_p0") {
) c;
"""
qt_sql "select * from test_element_at_view;"

sql "drop view if exists test_element_at_view"

sql "drop view if exists test_time_diff"

sql "create view test_time_diff as select minutes_diff('2023-01-16 10:05:04', '2023-01-15 18:05:04')"

qt_sql "select * from test_time_diff"

sql "drop view if exists test_time_diff"

}
Loading