summaryrefslogtreecommitdiff
path: root/sql/sql_window.cc
diff options
context:
space:
mode:
authorVarun Gupta <varunraiko1803@gmail.com>2018-10-15 09:35:19 -0700
committerVarun Gupta <varunraiko1803@gmail.com>2018-10-16 08:11:26 -0700
commit97a37edc970f8619ffd23394b61fe310d705d0ef (patch)
tree8dad954c1cc548bde5be847599654ba29c39c0c2 /sql/sql_window.cc
parent103b1df510599255f464de5c85a8b0ab1bb1283e (diff)
downloadmariadb-git-97a37edc970f8619ffd23394b61fe310d705d0ef.tar.gz
MDEV-17137: Syntax errors with VIEW using MEDIAN
The syntax error happened because we had not implemented a different print for percentile functions. The syntax is a bit different when we use percentile functions as window functions in comparision to normal window functions. Implemented a seperate print function for percentile functions
Diffstat (limited to 'sql/sql_window.cc')
-rw-r--r--sql/sql_window.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 38fdd8ab80b..e4d69f2fa5e 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -82,19 +82,32 @@ void
Window_spec::print(String *str, enum_query_type query_type)
{
str->append('(');
+ print_partition(str, query_type);
+ print_order(str, query_type);
+
+ if (window_frame)
+ window_frame->print(str, query_type);
+ str->append(')');
+}
+
+void
+Window_spec::print_partition(String *str, enum_query_type query_type)
+{
if (partition_list->first)
{
str->append(STRING_WITH_LEN(" partition by "));
st_select_lex::print_order(str, partition_list->first, query_type);
}
+}
+
+void
+Window_spec::print_order(String *str, enum_query_type query_type)
+{
if (order_list->first)
{
str->append(STRING_WITH_LEN(" order by "));
st_select_lex::print_order(str, order_list->first, query_type);
}
- if (window_frame)
- window_frame->print(str, query_type);
- str->append(')');
}
bool