Loading sql/Makefile.am +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ slave.cc sql_repl.cc sql_union.cc \ mini_client.cc mini_client_errors.c \ stacktrace.c repl_failsafe.h repl_failsafe.cc stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc gen_lex_hash_SOURCES = gen_lex_hash.cc gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS) Loading sql/lex.h +2 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ static SYMBOL symbols[] = { { "CONSTRAINT", SYM(CONSTRAINT),0,0}, { "CREATE", SYM(CREATE),0,0}, { "CROSS", SYM(CROSS),0,0}, { "CUBE", SYM(CUBE),0,0}, { "CURRENT_DATE", SYM(CURDATE),0,0}, { "CURRENT_TIME", SYM(CURTIME),0,0}, { "CURRENT_TIMESTAMP", SYM(NOW_SYM),0,0}, Loading Loading @@ -303,6 +304,7 @@ static SYMBOL symbols[] = { { "RIGHT", SYM(RIGHT),0,0}, { "RLIKE", SYM(REGEXP),0,0}, /* Like in mSQL2 */ { "ROLLBACK", SYM(ROLLBACK_SYM),0,0}, { "ROLLUP", SYM(ROLLUP),0,0}, { "ROW", SYM(ROW_SYM),0,0}, { "ROWS", SYM(ROWS_SYM),0,0}, { "SECOND", SYM(SECOND_SYM),0,0}, Loading sql/sql_lex.h +9 −3 Original line number Diff line number Diff line Loading @@ -89,7 +89,12 @@ typedef struct st_lex_master_info enum sub_select_type { UNSPECIFIED_TYPE, UNION_TYPE, INTERSECT_TYPE, EXCEPT_TYPE, NOT_A_SELECT UNSPECIFIED_TYPE, UNION_TYPE, INTERSECT_TYPE, EXCEPT_TYPE, OLAP_TYPE, NOT_A_SELECT }; enum olap_type { NON_EXISTING_ONE, CUBE_TYPE, ROLLUP_TYPE }; /* The state of the lex parsing for selects */ Loading @@ -97,6 +102,7 @@ enum sub_select_type typedef struct st_select_lex { enum sub_select_type linkage; enum olap_type olap; char *db,*db1,*table1,*db2,*table2; /* For outer join using .. */ Item *where,*having; ha_rows select_limit,offset_limit; Loading Loading @@ -133,7 +139,7 @@ typedef struct st_lex { uint yylineno,yytoklen; /* Simulate lex */ LEX_YYSTYPE yylval; SELECT_LEX select_lex, *select; SELECT_LEX select_lex, *select, *last_selects; uchar *ptr,*tok_start,*tok_end,*end_of_query; char *length,*dec,*change,*name; char *backup_dir; /* For RESTORE/BACKUP */ Loading Loading @@ -178,7 +184,7 @@ typedef struct st_lex uint grant,grant_tot_col,which_columns, union_option; thr_lock_type lock_option; bool drop_primary,drop_if_exists,local_file; bool in_comment,ignore_space,verbose,simple_alter, option_type; bool in_comment,ignore_space,verbose,simple_alter, option_type, olap; uint slave_thd_opt; } LEX; Loading sql/sql_parse.cc +3 −0 Original line number Diff line number Diff line Loading @@ -2728,7 +2728,9 @@ mysql_init_select(LEX *lex) select_lex->offset_limit=0; select_lex->options=0; select_lex->linkage=UNSPECIFIED_TYPE; select_lex->olap= NON_EXISTING_ONE; lex->exchange = 0; lex->olap = 0; lex->proc_list.first=0; select_lex->order_list.elements=select_lex->group_list.elements=0; select_lex->order_list.first=0; Loading Loading @@ -3270,6 +3272,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result) for (; aux; aux=next) { TABLE_LIST *cursor; aux->do_redirect=true; next= aux->next; for (cursor= *result; cursor; cursor=cursor->next) if (!strcmp(cursor->db,aux->db) && Loading sql/sql_select.cc +18 −1 Original line number Diff line number Diff line Loading @@ -146,7 +146,7 @@ static bool update_sum_func(Item_sum **func); static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, bool distinct, const char *message=NullS); static void describe_info(JOIN *join, const char *info); extern int handle_olaps(LEX *lex, SELECT_LEX *select); /* This handles SELECT with and without UNION */ Loading @@ -155,6 +155,23 @@ int handle_select(THD *thd, LEX *lex, select_result *result) { int res; register SELECT_LEX *select_lex = &lex->select_lex; if (lex->olap) { SELECT_LEX *sl, *last_sl; int returned; for (sl= &lex->select_lex;sl;sl=sl->next) { if (sl->olap != NON_EXISTING_ONE) { last_sl=sl->next; if ((returned=handle_olaps(lex,sl))) return returned; lex->last_selects->next=sl=last_sl; if (!sl) break; } } lex->select = select_lex; } if (select_lex->next) res=mysql_union(thd,lex,result); else Loading Loading
sql/Makefile.am +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ slave.cc sql_repl.cc sql_union.cc \ mini_client.cc mini_client_errors.c \ stacktrace.c repl_failsafe.h repl_failsafe.cc stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc gen_lex_hash_SOURCES = gen_lex_hash.cc gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS) Loading
sql/lex.h +2 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ static SYMBOL symbols[] = { { "CONSTRAINT", SYM(CONSTRAINT),0,0}, { "CREATE", SYM(CREATE),0,0}, { "CROSS", SYM(CROSS),0,0}, { "CUBE", SYM(CUBE),0,0}, { "CURRENT_DATE", SYM(CURDATE),0,0}, { "CURRENT_TIME", SYM(CURTIME),0,0}, { "CURRENT_TIMESTAMP", SYM(NOW_SYM),0,0}, Loading Loading @@ -303,6 +304,7 @@ static SYMBOL symbols[] = { { "RIGHT", SYM(RIGHT),0,0}, { "RLIKE", SYM(REGEXP),0,0}, /* Like in mSQL2 */ { "ROLLBACK", SYM(ROLLBACK_SYM),0,0}, { "ROLLUP", SYM(ROLLUP),0,0}, { "ROW", SYM(ROW_SYM),0,0}, { "ROWS", SYM(ROWS_SYM),0,0}, { "SECOND", SYM(SECOND_SYM),0,0}, Loading
sql/sql_lex.h +9 −3 Original line number Diff line number Diff line Loading @@ -89,7 +89,12 @@ typedef struct st_lex_master_info enum sub_select_type { UNSPECIFIED_TYPE, UNION_TYPE, INTERSECT_TYPE, EXCEPT_TYPE, NOT_A_SELECT UNSPECIFIED_TYPE, UNION_TYPE, INTERSECT_TYPE, EXCEPT_TYPE, OLAP_TYPE, NOT_A_SELECT }; enum olap_type { NON_EXISTING_ONE, CUBE_TYPE, ROLLUP_TYPE }; /* The state of the lex parsing for selects */ Loading @@ -97,6 +102,7 @@ enum sub_select_type typedef struct st_select_lex { enum sub_select_type linkage; enum olap_type olap; char *db,*db1,*table1,*db2,*table2; /* For outer join using .. */ Item *where,*having; ha_rows select_limit,offset_limit; Loading Loading @@ -133,7 +139,7 @@ typedef struct st_lex { uint yylineno,yytoklen; /* Simulate lex */ LEX_YYSTYPE yylval; SELECT_LEX select_lex, *select; SELECT_LEX select_lex, *select, *last_selects; uchar *ptr,*tok_start,*tok_end,*end_of_query; char *length,*dec,*change,*name; char *backup_dir; /* For RESTORE/BACKUP */ Loading Loading @@ -178,7 +184,7 @@ typedef struct st_lex uint grant,grant_tot_col,which_columns, union_option; thr_lock_type lock_option; bool drop_primary,drop_if_exists,local_file; bool in_comment,ignore_space,verbose,simple_alter, option_type; bool in_comment,ignore_space,verbose,simple_alter, option_type, olap; uint slave_thd_opt; } LEX; Loading
sql/sql_parse.cc +3 −0 Original line number Diff line number Diff line Loading @@ -2728,7 +2728,9 @@ mysql_init_select(LEX *lex) select_lex->offset_limit=0; select_lex->options=0; select_lex->linkage=UNSPECIFIED_TYPE; select_lex->olap= NON_EXISTING_ONE; lex->exchange = 0; lex->olap = 0; lex->proc_list.first=0; select_lex->order_list.elements=select_lex->group_list.elements=0; select_lex->order_list.first=0; Loading Loading @@ -3270,6 +3272,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result) for (; aux; aux=next) { TABLE_LIST *cursor; aux->do_redirect=true; next= aux->next; for (cursor= *result; cursor; cursor=cursor->next) if (!strcmp(cursor->db,aux->db) && Loading
sql/sql_select.cc +18 −1 Original line number Diff line number Diff line Loading @@ -146,7 +146,7 @@ static bool update_sum_func(Item_sum **func); static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, bool distinct, const char *message=NullS); static void describe_info(JOIN *join, const char *info); extern int handle_olaps(LEX *lex, SELECT_LEX *select); /* This handles SELECT with and without UNION */ Loading @@ -155,6 +155,23 @@ int handle_select(THD *thd, LEX *lex, select_result *result) { int res; register SELECT_LEX *select_lex = &lex->select_lex; if (lex->olap) { SELECT_LEX *sl, *last_sl; int returned; for (sl= &lex->select_lex;sl;sl=sl->next) { if (sl->olap != NON_EXISTING_ONE) { last_sl=sl->next; if ((returned=handle_olaps(lex,sl))) return returned; lex->last_selects->next=sl=last_sl; if (!sl) break; } } lex->select = select_lex; } if (select_lex->next) res=mysql_union(thd,lex,result); else Loading