diff options
author | Varun Gupta <varunraiko1803@gmail.com> | 2017-06-13 11:54:39 +0530 |
---|---|---|
committer | Varun Gupta <varunraiko1803@gmail.com> | 2017-11-01 23:13:01 +0530 |
commit | fadfe447e8d9b1244341bd5ed94bb7f8eb623f18 (patch) | |
tree | fe2e5df02fcc98a0ba426e129cd539ddbcebe45f | |
parent | 29c4bd9d27996600790be45ae057214381c7d3a8 (diff) | |
download | mariadb-git-fadfe447e8d9b1244341bd5ed94bb7f8eb623f18.tar.gz |
MDEV-12985: syntax added for the percentile_cont and percentile_disc functions
-rw-r--r-- | sql/lex.h | 3 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 25 |
2 files changed, 27 insertions, 1 deletions
diff --git a/sql/lex.h b/sql/lex.h index ef03afb7a32..7967d17a5d4 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -701,6 +701,7 @@ static SYMBOL symbols[] = { { "WHILE", SYM(WHILE_SYM)}, { "WINDOW", SYM(WINDOW_SYM)}, { "WITH", SYM(WITH)}, + { "WITHIN", SYM(WITHIN)}, { "WORK", SYM(WORK_SYM)}, { "WRAPPER", SYM(WRAPPER_SYM)}, { "WRITE", SYM(WRITE_SYM)}, @@ -743,6 +744,8 @@ static SYMBOL sql_functions[] = { { "NTILE", SYM(NTILE_SYM)}, { "POSITION", SYM(POSITION_SYM)}, { "PERCENT_RANK", SYM(PERCENT_RANK_SYM)}, + { "PERCENTILE_CONT", SYM(PERCENTILE_CONT_SYM)}, + { "PERCENTILE_DISC", SYM(PERCENTILE_DISC_SYM)}, { "RANK", SYM(RANK_SYM)}, { "ROW_NUMBER", SYM(ROW_NUMBER_SYM)}, { "SESSION_USER", SYM(USER_SYM)}, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 67b73dea506..57d7ecd48c8 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1328,6 +1328,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token PARTITIONING_SYM %token PASSWORD_SYM %token PERCENT_RANK_SYM +%token PERCENTILE_CONT_SYM +%token PERCENTILE_DISC_SYM %token PERSISTENT_SYM %token PHASE_SYM %token PLUGINS_SYM @@ -1574,6 +1576,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token WINDOW_SYM %token WHILE_SYM %token WITH /* SQL-2003-R */ +%token WITHIN %token WITH_CUBE_SYM /* INTERNAL */ %token WITH_ROLLUP_SYM /* INTERNAL */ %token WORK_SYM /* SQL-2003-N */ @@ -1733,6 +1736,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); window_func_expr window_func simple_window_func + inverse_distribution_function function_call_keyword function_call_nonkeyword function_call_generic @@ -1951,7 +1955,6 @@ END_OF_INPUT %type <spvar_definition> row_field_name row_field_definition %type <spvar_definition_list> row_field_definition_list row_type_body - %type <NONE> opt_window_clause window_def_list window_def window_spec %type <lex_str_ptr> window_name %type <NONE> opt_window_ref opt_window_frame_clause @@ -9374,6 +9377,7 @@ column_default_non_parenthesized_expr: | variable | sum_expr | window_func_expr + | inverse_distribution_function | ROW_SYM '(' expr ',' expr_list ')' { $5->push_front($3, thd->mem_root); @@ -10693,6 +10697,25 @@ simple_window_func: } ; + +inverse_distribution_function: + inverse_distribution_function_type '(' expr ')' WITHIN GROUP_SYM + '(' order_by_single_element_list ')' OVER_SYM '(' opt_window_ref opt_window_partition_clause ')' + { + my_yyabort_error((ER_VIEW_SELECT_VARIABLE, MYF(0))); + }; + +inverse_distribution_function_type: + PERCENTILE_CONT_SYM + {} + |PERCENTILE_DISC_SYM + {} + ; + +order_by_single_element_list: + ORDER_SYM BY order_ident order_dir + ; + window_name: ident { |