MDEV-27644 Spider: remove HANDLER_HAS_DIRECT_AGGREGATE

This commit is contained in:
Yuchen Pei 2024-06-19 13:52:29 +08:00
parent 3a58291680
commit 869c501ac3
No known key found for this signature in database
GPG key ID: 3DD1B35105743563
13 changed files with 0 additions and 226 deletions

View file

@ -26,9 +26,7 @@
#include "probes_mysql.h"
#include "sql_class.h"
#include "key.h"
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h"
#endif
#include "ha_partition.h"
#include "spd_param.h"
#include "spd_err.h"
@ -109,9 +107,7 @@ ha_spider::ha_spider(
*/
#endif
prev_index_rnd_init = SPD_NONE;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
direct_aggregate_item_first = NULL;
#endif
result_link_idx = 0;
result_list.have_sql_kind_backup = FALSE;
result_list.sqls = NULL;
@ -125,10 +121,8 @@ ha_spider::ha_spider(
result_list.set_split_read = FALSE;
result_list.insert_dup_update_pushdown = FALSE;
result_list.tmp_pos_row_first = NULL;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
result_list.direct_aggregate = FALSE;
result_list.snap_direct_aggregate = FALSE;
#endif
result_list.direct_distinct = FALSE;
result_list.casual_read = NULL;
result_list.use_both_key = FALSE;
@ -192,9 +186,7 @@ ha_spider::ha_spider(
*/
#endif
prev_index_rnd_init = SPD_NONE;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
direct_aggregate_item_first = NULL;
#endif
result_link_idx = 0;
result_list.have_sql_kind_backup = FALSE;
result_list.sqls = NULL;
@ -208,10 +200,8 @@ ha_spider::ha_spider(
result_list.set_split_read = FALSE;
result_list.insert_dup_update_pushdown = FALSE;
result_list.tmp_pos_row_first = NULL;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
result_list.direct_aggregate = FALSE;
result_list.snap_direct_aggregate = FALSE;
#endif
result_list.direct_distinct = FALSE;
result_list.casual_read = NULL;
result_list.use_both_key = FALSE;
@ -634,7 +624,6 @@ int ha_spider::close()
} while (bulk_access_link_first);
}
#endif
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
while (direct_aggregate_item_first)
{
direct_aggregate_item_current = direct_aggregate_item_first->next;
@ -645,7 +634,6 @@ int ha_spider::close()
spider_free(spider_current_trx, direct_aggregate_item_first, MYF(0));
direct_aggregate_item_first = direct_aggregate_item_current;
}
#endif
if (is_clone)
{
for (roop_count = 0; roop_count < (int) share->link_count; roop_count++)
@ -1191,7 +1179,6 @@ int ha_spider::reset()
} while (bulk_access_link_first);
}
#endif
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
direct_aggregate_item_current = direct_aggregate_item_first;
while (direct_aggregate_item_current)
{
@ -1211,7 +1198,6 @@ int ha_spider::reset()
}
result_list.direct_aggregate = FALSE;
result_list.snap_direct_aggregate = FALSE;
#endif
result_list.direct_distinct = FALSE;
store_error_num = 0;
if (wide_handler)
@ -4784,10 +4770,8 @@ int ha_spider::read_multi_range_first_internal(
DBUG_RETURN(error_num);
result_list.use_union = TRUE;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool direct_aggregate_backup = result_list.direct_aggregate;
result_list.direct_aggregate = FALSE;
#endif
if (result_list.direct_order_limit)
{
if ((error_num =
@ -4799,9 +4783,7 @@ int ha_spider::read_multi_range_first_internal(
NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
result_list.direct_aggregate = direct_aggregate_backup;
#endif
if ((error_num = append_limit_sql_part(
result_list.internal_offset,
result_list.limit_num,
@ -6199,10 +6181,8 @@ int ha_spider::read_multi_range_next(
DBUG_RETURN(error_num);
result_list.use_union = TRUE;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool direct_aggregate_backup = result_list.direct_aggregate;
result_list.direct_aggregate = FALSE;
#endif
if (result_list.direct_order_limit)
{
if ((error_num =
@ -6214,9 +6194,7 @@ int ha_spider::read_multi_range_next(
NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
result_list.direct_aggregate = direct_aggregate_backup;
#endif
if ((error_num = append_limit_sql_part(
result_list.internal_offset,
result_list.limit_num,
@ -6844,14 +6822,12 @@ int ha_spider::rnd_next_internal(
NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (result_list.direct_aggregate)
{
if ((error_num =
append_group_by_sql_part(NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
#endif
result_list.desc_flg = FALSE;
result_list.sorted = FALSE;
result_list.key_info = NULL;
@ -7476,14 +7452,12 @@ int ha_spider::ft_read_internal(
SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (result_list.direct_aggregate)
{
if ((error_num =
append_group_by_sql_part(NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
#endif
if (sql_kinds & SPIDER_SQL_KIND_SQL)
{
if ((error_num = append_limit_sql_part(
@ -11419,7 +11393,6 @@ int ha_spider::info_push(
DBUG_RETURN(error_num);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
void ha_spider::return_record_by_parent()
{
DBUG_ENTER("ha_spider::return_record_by_parent");
@ -11427,7 +11400,6 @@ void ha_spider::return_record_by_parent()
spider_db_refetch_for_item_sum_funcs(this);
DBUG_VOID_RETURN;
}
#endif
TABLE *ha_spider::get_table()
{
@ -13459,7 +13431,6 @@ int ha_spider::append_condition_sql_part(
DBUG_RETURN(0);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int ha_spider::append_sum_select_sql_part(
ulong sql_type,
const char *alias,
@ -13483,7 +13454,6 @@ int ha_spider::append_sum_select_sql_part(
}
DBUG_RETURN(0);
}
#endif
int ha_spider::append_match_select_sql_part(
ulong sql_type,
@ -13541,7 +13511,6 @@ void ha_spider::set_order_to_pos_sql(
DBUG_VOID_RETURN;
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int ha_spider::append_group_by_sql_part(
const char *alias,
uint alias_length,
@ -13565,7 +13534,6 @@ int ha_spider::append_group_by_sql_part(
}
DBUG_RETURN(0);
}
#endif
int ha_spider::append_key_order_for_merge_with_alias_sql_part(
const char *alias,
@ -13576,7 +13544,6 @@ int ha_spider::append_key_order_for_merge_with_alias_sql_part(
uint roop_count, dbton_id;
spider_db_handler *dbton_hdl;
DBUG_ENTER("ha_spider::append_key_order_for_merge_with_alias_sql_part");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (result_list.direct_aggregate)
{
st_select_lex *select_lex = spider_get_select_lex(this);
@ -13587,7 +13554,6 @@ int ha_spider::append_key_order_for_merge_with_alias_sql_part(
DBUG_RETURN(0);
}
}
#endif
for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++)
{
dbton_id = share->use_sql_dbton_ids[roop_count];
@ -13637,7 +13603,6 @@ int ha_spider::append_key_order_with_alias_sql_part(
uint roop_count, dbton_id;
spider_db_handler *dbton_hdl;
DBUG_ENTER("ha_spider::append_key_order_with_alias_sql_part");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (result_list.direct_aggregate)
{
st_select_lex *select_lex = spider_get_select_lex(this);
@ -13648,7 +13613,6 @@ int ha_spider::append_key_order_with_alias_sql_part(
DBUG_RETURN(0);
}
}
#endif
for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++)
{
dbton_id = share->use_sql_dbton_ids[roop_count];

View file

@ -174,10 +174,8 @@ public:
bool do_direct_update;
uint direct_update_kinds;
spider_index_rnd_init prev_index_rnd_init;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
SPIDER_ITEM_HLD *direct_aggregate_item_first;
SPIDER_ITEM_HLD *direct_aggregate_item_current;
#endif
ha_rows table_rows;
ha_checksum checksum_val;
bool checksum_null;
@ -734,9 +732,7 @@ public:
uint info_type,
void *info
) override;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
void return_record_by_parent() override;
#endif
TABLE *get_table();
void set_ft_discard_bitmap();
void set_searched_bitmap();
@ -923,13 +919,11 @@ public:
ulong sql_type,
bool test_flg
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_sum_select_sql_part(
ulong sql_type,
const char *alias,
uint alias_length
);
#endif
int append_match_select_sql_part(
ulong sql_type,
const char *alias,
@ -941,13 +935,11 @@ public:
void set_order_to_pos_sql(
ulong sql_type
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_group_by_sql_part(
const char *alias,
uint alias_length,
ulong sql_type
);
#endif
int append_key_order_for_merge_with_alias_sql_part(
const char *alias,
uint alias_length,

View file

@ -928,9 +928,7 @@ int spider_check_and_init_casual_read(
(!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
(
result_list->direct_order_limit
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|| result_list->direct_aggregate
#endif
)
) {
if (!result_list->casual_read[link_idx])

View file

@ -26,9 +26,7 @@
#include "sql_base.h"
#include "tztime.h"
#include "errmsg.h"
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h"
#endif
#include "sql_common.h"
#include <errmsg.h>
#include "spd_err.h"
@ -1390,14 +1388,12 @@ int spider_db_append_select_columns(
DBUG_ENTER("spider_db_append_select_columns");
if (spider->sql_kinds & SPIDER_SQL_KIND_SQL)
{
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (
result_list->direct_aggregate &&
(error_num = spider->append_sum_select_sql_part(
SPIDER_SQL_TYPE_SELECT_SQL, NULL, 0))
)
DBUG_RETURN(error_num);
#endif
if ((error_num = spider->append_match_select_sql_part(
SPIDER_SQL_TYPE_SELECT_SQL, NULL, 0)))
DBUG_RETURN(error_num);
@ -2536,7 +2532,6 @@ int spider_db_append_charset_name_before_string(
DBUG_RETURN(0);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_refetch_for_item_sum_funcs(
ha_spider *spider
) {
@ -2752,7 +2747,6 @@ int spider_db_fetch_for_item_sum_func(
spider->wide_handler->trx->direct_aggregate_count++;
DBUG_RETURN(0);
}
#endif
int spider_db_append_match_fetch(
ha_spider *spider,
@ -2951,13 +2945,11 @@ int spider_db_fetch_table(
}
DBUG_PRINT("info", ("spider row=%p", row));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
DBUG_PRINT("info", ("spider direct_aggregate=%s",
result_list->direct_aggregate ? "TRUE" : "FALSE"));
result_list->snap_mrr_with_cnt = spider->mrr_with_cnt;
result_list->snap_direct_aggregate = result_list->direct_aggregate;
result_list->snap_row = row;
#endif
/* for mrr */
if (spider->mrr_with_cnt)
@ -2967,32 +2959,26 @@ int spider_db_fetch_table(
{
if (!row->is_null())
spider->multi_range_hit_point = row->val_int();
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (result_list->direct_aggregate)
{
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
#endif
else
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
row->next();
} else {
spider->multi_range_hit_point = 0;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
result_list->snap_mrr_with_cnt = FALSE;
#endif
}
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (result_list->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
#endif
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
if (!spider->use_fields)
@ -3081,13 +3067,11 @@ int spider_db_fetch_key(
}
DBUG_PRINT("info", ("spider row=%p", row));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
DBUG_PRINT("info", ("spider direct_aggregate=%s",
result_list->direct_aggregate ? "TRUE" : "FALSE"));
result_list->snap_mrr_with_cnt = spider->mrr_with_cnt;
result_list->snap_direct_aggregate = result_list->direct_aggregate;
result_list->snap_row = row;
#endif
/* for mrr */
if (spider->mrr_with_cnt)
@ -3095,26 +3079,22 @@ int spider_db_fetch_key(
DBUG_PRINT("info", ("spider mrr_with_cnt"));
if (!row->is_null())
spider->multi_range_hit_point = row->val_int();
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (result_list->direct_aggregate)
{
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
#endif
else
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
row->next();
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (result_list->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
#endif
if ((error_num = spider_db_append_match_fetch(spider,
spider->ft_first, spider->ft_current, row)))
@ -3198,13 +3178,11 @@ int spider_db_fetch_minimum_columns(
}
DBUG_PRINT("info", ("spider row=%p", row));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
DBUG_PRINT("info", ("spider direct_aggregate=%s",
result_list->direct_aggregate ? "TRUE" : "FALSE"));
result_list->snap_mrr_with_cnt = spider->mrr_with_cnt;
result_list->snap_direct_aggregate = result_list->direct_aggregate;
result_list->snap_row = row;
#endif
/* for mrr */
if (spider->mrr_with_cnt)
@ -3212,26 +3190,22 @@ int spider_db_fetch_minimum_columns(
DBUG_PRINT("info", ("spider mrr_with_cnt"));
if (!row->is_null())
spider->multi_range_hit_point = row->val_int();
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (result_list->direct_aggregate)
{
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
#endif
else
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
row->next();
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (result_list->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
#endif
if ((error_num = spider_db_append_match_fetch(spider,
spider->ft_first, spider->ft_current, row)))
@ -5580,9 +5554,7 @@ void spider_db_create_position(
current->use_position = TRUE;
pos->use_position = TRUE;
pos->mrr_with_cnt = spider->mrr_with_cnt;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
pos->direct_aggregate = result_list->direct_aggregate;
#endif
pos->sql_kind = spider->sql_kind[spider->result_link_idx];
pos->position_bitmap = spider->wide_handler->position_bitmap;
pos->ft_first = spider->ft_first;
@ -5648,7 +5620,6 @@ int spider_db_seek_tmp_table(
}
DBUG_PRINT("info", ("spider row=%p", row));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (!spider->result_list.in_cmp_ref)
{
DBUG_PRINT("info", ("spider direct_aggregate=%s",
@ -5657,7 +5628,6 @@ int spider_db_seek_tmp_table(
spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
spider->result_list.snap_row = row;
}
#endif
/* for mrr */
if (pos->mrr_with_cnt)
@ -5667,20 +5637,16 @@ int spider_db_seek_tmp_table(
{
row->next();
} else {
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.snap_mrr_with_cnt = FALSE;
#endif
}
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (pos->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
#endif
if ((error_num = spider_db_append_match_fetch(spider,
pos->ft_first, pos->ft_current, row)))
@ -5740,7 +5706,6 @@ int spider_db_seek_tmp_key(
}
DBUG_PRINT("info", ("spider row=%p", row));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (!spider->result_list.in_cmp_ref)
{
DBUG_PRINT("info", ("spider direct_aggregate=%s",
@ -5749,7 +5714,6 @@ int spider_db_seek_tmp_key(
spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
spider->result_list.snap_row = row;
}
#endif
/* for mrr */
if (pos->mrr_with_cnt)
@ -5758,14 +5722,12 @@ int spider_db_seek_tmp_key(
row->next();
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (pos->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
#endif
if ((error_num = spider_db_append_match_fetch(spider,
pos->ft_first, pos->ft_current, row)))
@ -5825,7 +5787,6 @@ int spider_db_seek_tmp_minimum_columns(
}
DBUG_PRINT("info", ("spider row=%p", row));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (!spider->result_list.in_cmp_ref)
{
DBUG_PRINT("info", ("spider direct_aggregate=%s",
@ -5834,7 +5795,6 @@ int spider_db_seek_tmp_minimum_columns(
spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
spider->result_list.snap_row = row;
}
#endif
/* for mrr */
if (pos->mrr_with_cnt)
@ -5843,14 +5803,12 @@ int spider_db_seek_tmp_minimum_columns(
row->next();
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (pos->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
#endif
if ((error_num = spider_db_append_match_fetch(spider,
pos->ft_first, pos->ft_current, row)))
@ -8554,11 +8512,9 @@ int spider_db_print_item_type(
case Item::FUNC_ITEM:
DBUG_RETURN(spider_db_open_item_func((Item_func *) item, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
case Item::SUM_FUNC_ITEM:
DBUG_RETURN(spider_db_open_item_sum_func((Item_sum *)item, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
#endif
case Item::COND_ITEM:
DBUG_RETURN(spider_db_open_item_cond((Item_cond *) item, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
@ -8731,7 +8687,6 @@ int spider_db_open_item_func(
item_func, spider, str, alias, alias_length, use_fields, fields));
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@ -8746,7 +8701,6 @@ int spider_db_open_item_sum_func(
DBUG_RETURN(spider_dbton[dbton_id].db_util->open_item_sum_func(
item_sum, spider, str, alias, alias_length, use_fields, fields));
}
#endif
int spider_db_open_item_ident(
Item_ident *item_ident,
@ -9536,7 +9490,6 @@ int spider_db_append_update_columns(
DBUG_RETURN(0);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool spider_db_check_select_colum_in_group(
st_select_lex *select_lex,
Field *field
@ -9559,7 +9512,6 @@ bool spider_db_check_select_colum_in_group(
}
DBUG_RETURN(FALSE);
}
#endif
uint spider_db_check_ft_idx(
Item_func *item_func,

View file

@ -496,7 +496,6 @@ int spider_db_append_charset_name_before_string(
CHARSET_INFO *cs
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_refetch_for_item_sum_funcs(
ha_spider *spider
);
@ -511,7 +510,6 @@ int spider_db_fetch_for_item_sum_func(
Item_sum *item_sum,
ha_spider *spider
);
#endif
int spider_db_append_match_fetch(
ha_spider *spider,
@ -940,7 +938,6 @@ int spider_db_open_item_func(
spider_fields *fields
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@ -951,7 +948,6 @@ int spider_db_open_item_sum_func(
bool use_fields,
spider_fields *fields
);
#endif
int spider_db_open_item_ident(
Item_ident *item_ident,
@ -1062,12 +1058,10 @@ int spider_db_append_update_columns(
spider_fields *fields
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool spider_db_check_select_colum_in_group(
st_select_lex *select_lex,
Field *field
);
#endif
uint spider_db_check_ft_idx(
Item_func *item_func,

View file

@ -765,7 +765,6 @@ public:
bool use_fields,
spider_fields *fields
) = 0;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
virtual int open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@ -775,7 +774,6 @@ public:
bool use_fields,
spider_fields *fields
) = 0;
#endif
virtual int append_escaped_util(
spider_string *to,
String *from
@ -1275,26 +1273,22 @@ public:
const char *alias,
uint alias_length
) = 0;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
virtual int append_sum_select_part(
ulong sql_type,
const char *alias,
uint alias_length
) = 0;
#endif
virtual void set_order_pos(
ulong sql_type
) = 0;
virtual void set_order_to_pos(
ulong sql_type
) = 0;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
virtual int append_group_by_part(
const char *alias,
uint alias_length,
ulong sql_type
) = 0;
#endif
virtual int append_key_order_for_merge_with_alias_part(
const char *alias,
uint alias_length,
@ -1717,9 +1711,7 @@ typedef struct st_spider_position
uint pos_mode;
bool use_position;
bool mrr_with_cnt;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool direct_aggregate;
#endif
uint sql_kind;
uchar *position_bitmap;
st_spider_ft_info *ft_first;
@ -1822,12 +1814,10 @@ typedef struct st_spider_result_list
/* the limit_offeset, without where condition */
bool direct_limit_offset;
bool direct_distinct;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool direct_aggregate;
bool snap_mrr_with_cnt;
bool snap_direct_aggregate;
SPIDER_DB_ROW *snap_row;
#endif
bool in_cmp_ref;
bool set_split_read;
bool insert_dup_update_pushdown;

View file

@ -25,9 +25,7 @@
#include "sql_analyse.h"
#include "sql_base.h"
#include "tztime.h"
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h"
#endif
#include "sql_common.h"
#include <mysql.h>
#include <errmsg.h>
@ -6688,7 +6686,6 @@ int spider_db_mbase_util::print_item_func(
DBUG_RETURN(0);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_mbase_util::open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@ -6804,7 +6801,6 @@ int spider_db_mbase_util::open_item_sum_func(
}
DBUG_RETURN(0);
}
#endif
int spider_db_mbase_util::append_escaped_util(
spider_string *to,
@ -8643,14 +8639,12 @@ int spider_mbase_handler::append_tmp_table_and_sql_for_bka(
SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
DBUG_RETURN(error_num);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (spider->result_list.direct_aggregate)
{
if ((error_num =
append_group_by(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
DBUG_RETURN(error_num);
}
#endif
DBUG_RETURN(0);
}
@ -8889,14 +8883,12 @@ int spider_mbase_handler::append_union_table_and_sql_for_bka(
)
DBUG_RETURN(error_num);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (spider->result_list.direct_aggregate)
{
if ((error_num =
append_group_by(&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
DBUG_RETURN(error_num);
}
#endif
DBUG_RETURN(0);
}
@ -9504,13 +9496,10 @@ int spider_mbase_handler::append_table_select_part(
int spider_mbase_handler::append_table_select(
spider_string *str
) {
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
#endif
DBUG_ENTER("spider_mbase_handler::append_table_select");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@ -9549,13 +9538,10 @@ int spider_mbase_handler::append_table_select(
}
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
} else {
#endif
table_name_pos = str->length() + mysql_share->table_select_pos;
if (str->append(*(mysql_share->table_select)))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
#endif
DBUG_RETURN(0);
}
@ -9583,13 +9569,10 @@ int spider_mbase_handler::append_key_select(
spider_string *str,
uint idx
) {
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
#endif
DBUG_ENTER("spider_mbase_handler::append_key_select");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@ -9633,13 +9616,10 @@ int spider_mbase_handler::append_key_select(
}
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
} else {
#endif
table_name_pos = str->length() + mysql_share->key_select_pos[idx];
if (str->append(mysql_share->key_select[idx]))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
#endif
DBUG_RETURN(0);
}
@ -9670,13 +9650,10 @@ int spider_mbase_handler::append_minimum_select(
Field **field;
int field_length;
bool appended = FALSE;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
#endif
DBUG_ENTER("spider_mbase_handler::append_minimum_select");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@ -9686,7 +9663,6 @@ int spider_mbase_handler::append_minimum_select(
select_lex = NULL;
}
}
#endif
minimum_select_bitmap_create();
for (field = table->field; *field; field++)
{
@ -9697,7 +9673,6 @@ int spider_mbase_handler::append_minimum_select(
*/
field_length =
mysql_share->column_name_str[(*field)->field_index].length();
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (select_lex &&
!spider_db_check_select_colum_in_group(select_lex, *field))
{
@ -9710,14 +9685,11 @@ int spider_mbase_handler::append_minimum_select(
mysql_share->append_column_name(str, (*field)->field_index);
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
} else {
#endif
if (str->reserve(field_length +
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
mysql_share->append_column_name(str, (*field)->field_index);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
#endif
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
appended = TRUE;
}
@ -9740,13 +9712,10 @@ int spider_mbase_handler::append_table_select_with_alias(
TABLE *table = spider->get_table();
Field **field;
int field_length;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
#endif
DBUG_ENTER("spider_mbase_handler::append_table_select_with_alias");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@ -9756,12 +9725,10 @@ int spider_mbase_handler::append_table_select_with_alias(
select_lex = NULL;
}
}
#endif
for (field = table->field; *field; field++)
{
field_length =
mysql_share->column_name_str[(*field)->field_index].length();
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (select_lex &&
!spider_db_check_select_colum_in_group(select_lex, *field))
{
@ -9775,15 +9742,12 @@ int spider_mbase_handler::append_table_select_with_alias(
mysql_share->append_column_name(str, (*field)->field_index);
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
} else {
#endif
if (str->reserve(alias_length + field_length +
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(alias, alias_length);
mysql_share->append_column_name(str, (*field)->field_index);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
#endif
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
@ -9800,13 +9764,10 @@ int spider_mbase_handler::append_key_select_with_alias(
Field *field;
uint part_num;
int field_length;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
#endif
DBUG_ENTER("spider_mbase_handler::append_key_select_with_alias");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@ -9816,13 +9777,11 @@ int spider_mbase_handler::append_key_select_with_alias(
select_lex = NULL;
}
}
#endif
for (key_part = key_info->key_part, part_num = 0;
part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++)
{
field = key_part->field;
field_length = mysql_share->column_name_str[field->field_index].length();
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (select_lex &&
!spider_db_check_select_colum_in_group(select_lex, field))
{
@ -9836,15 +9795,12 @@ int spider_mbase_handler::append_key_select_with_alias(
mysql_share->append_column_name(str, field->field_index);
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
} else {
#endif
if (str->reserve(alias_length + field_length +
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(alias, alias_length);
mysql_share->append_column_name(str, field->field_index);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
#endif
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
@ -9860,13 +9816,10 @@ int spider_mbase_handler::append_minimum_select_with_alias(
Field **field;
int field_length;
bool appended = FALSE;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
#endif
DBUG_ENTER("spider_mbase_handler::append_minimum_select_with_alias");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@ -9876,7 +9829,6 @@ int spider_mbase_handler::append_minimum_select_with_alias(
select_lex = NULL;
}
}
#endif
minimum_select_bitmap_create();
for (field = table->field; *field; field++)
{
@ -9887,7 +9839,6 @@ int spider_mbase_handler::append_minimum_select_with_alias(
*/
field_length =
mysql_share->column_name_str[(*field)->field_index].length();
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (select_lex &&
!spider_db_check_select_colum_in_group(select_lex, *field))
{
@ -9901,15 +9852,12 @@ int spider_mbase_handler::append_minimum_select_with_alias(
mysql_share->append_column_name(str, (*field)->field_index);
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
} else {
#endif
if (str->reserve(alias_length + field_length +
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(alias, alias_length);
mysql_share->append_column_name(str, (*field)->field_index);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
#endif
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
appended = TRUE;
}
@ -9932,13 +9880,11 @@ int spider_mbase_handler::append_select_columns_with_alias(
int error_num;
SPIDER_RESULT_LIST *result_list = &spider->result_list;
DBUG_ENTER("spider_mbase_handler::append_select_columns_with_alias");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (
result_list->direct_aggregate &&
(error_num = append_sum_select(str, alias, alias_length))
)
DBUG_RETURN(error_num);
#endif
if ((error_num = append_match_select(str, alias, alias_length)))
DBUG_RETURN(error_num);
if (!spider->select_column_mode)
@ -11098,7 +11044,6 @@ int spider_mbase_handler::append_match_select(
DBUG_RETURN(0);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_mbase_handler::append_sum_select_part(
ulong sql_type,
const char *alias,
@ -11145,7 +11090,6 @@ int spider_mbase_handler::append_sum_select(
}
DBUG_RETURN(0);
}
#endif
void spider_mbase_handler::set_order_pos(
ulong sql_type
@ -11199,7 +11143,6 @@ void spider_mbase_handler::set_order_to_pos(
DBUG_VOID_RETURN;
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_mbase_handler::append_group_by_part(
const char *alias,
uint alias_length,
@ -11262,7 +11205,6 @@ int spider_mbase_handler::append_group_by(
}
DBUG_RETURN(0);
}
#endif
int spider_mbase_handler::append_key_order_for_merge_with_alias_part(
const char *alias,
@ -11308,14 +11250,12 @@ int spider_mbase_handler::append_key_order_for_merge_with_alias(
uint key_name_length;
DBUG_ENTER("spider_mbase_handler::append_key_order_for_merge_with_alias");
DBUG_PRINT("info",("spider this=%p", this));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (spider->result_list.direct_aggregate)
{
int error_num;
if ((error_num = append_group_by(str, alias, alias_length)))
DBUG_RETURN(error_num);
}
#endif
if (table->s->primary_key < MAX_KEY)
{
/* sort by primary key */
@ -11424,13 +11364,11 @@ int spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias(
longlong offset_limit;
DBUG_ENTER("spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias");
DBUG_PRINT("info",("spider this=%p", this));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (spider->result_list.direct_aggregate)
{
if ((error_num = append_group_by(str, alias, alias_length)))
DBUG_RETURN(error_num);
}
#endif
spider_get_select_limit(spider, &select_lex, &select_limit,
&offset_limit);
if (select_lex->order_list.first)
@ -11526,14 +11464,12 @@ int spider_mbase_handler::append_key_order_with_alias(
uint key_name_length;
DBUG_ENTER("spider_mbase_handler::append_key_order_with_alias");
DBUG_PRINT("info",("spider this=%p", this));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (spider->result_list.direct_aggregate)
{
int error_num;
if ((error_num = append_group_by(str, alias, alias_length)))
DBUG_RETURN(error_num);
}
#endif
if (result_list->sorted == TRUE)
{
if (result_list->desc_flg == TRUE)

View file

@ -145,7 +145,6 @@ protected:
spider_fields *fields
);
public:
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@ -155,7 +154,6 @@ public:
bool use_fields,
spider_fields *fields
) override;
#endif
int append_escaped_util(
spider_string *to,
String *from
@ -1068,7 +1066,6 @@ public:
const char *alias,
uint alias_length
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_sum_select_part(
ulong sql_type,
const char *alias,
@ -1079,14 +1076,12 @@ public:
const char *alias,
uint alias_length
);
#endif
void set_order_pos(
ulong sql_type
) override;
void set_order_to_pos(
ulong sql_type
) override;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_group_by_part(
const char *alias,
uint alias_length,
@ -1097,7 +1092,6 @@ public:
const char *alias,
uint alias_length
);
#endif
int append_key_order_for_merge_with_alias_part(
const char *alias,
uint alias_length,

View file

@ -22,9 +22,7 @@
#include "probes_mysql.h"
#include "sql_partition.h"
#include "sql_analyse.h"
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h"
#endif
#ifdef HAVE_ORACLE_OCI
#if (defined(WIN32) || defined(_WIN32) || defined(WINDOWS) || defined(_WINDOWS))
@ -4221,7 +4219,6 @@ int spider_db_oracle_util::open_item_func(
DBUG_RETURN(0);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_oracle_util::open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@ -4296,7 +4293,6 @@ int spider_db_oracle_util::open_item_sum_func(
}
DBUG_RETURN(0);
}
#endif
size_t spider_db_oracle_util::escape_string(
char *to,
@ -5731,14 +5727,12 @@ int spider_oracle_handler::append_tmp_table_and_sql_for_bka(
SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
DBUG_RETURN(error_num);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (spider->result_list.direct_aggregate)
{
if ((error_num =
append_group_by(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
DBUG_RETURN(error_num);
}
#endif
DBUG_RETURN(0);
}
@ -5971,14 +5965,12 @@ int spider_oracle_handler::append_union_table_and_sql_for_bka(
&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
DBUG_RETURN(error_num);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (spider->result_list.direct_aggregate)
{
if ((error_num =
append_group_by(&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
DBUG_RETURN(error_num);
}
#endif
DBUG_RETURN(0);
}
@ -6702,13 +6694,11 @@ int spider_oracle_handler::append_select_columns_with_alias(
int error_num;
SPIDER_RESULT_LIST *result_list = &spider->result_list;
DBUG_ENTER("spider_oracle_handler::append_select_columns_with_alias");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (
result_list->direct_aggregate &&
(error_num = append_sum_select(str, alias, alias_length))
)
DBUG_RETURN(error_num);
#endif
if ((error_num = append_match_select(str, alias, alias_length)))
DBUG_RETURN(error_num);
if (!spider->select_column_mode)
@ -7826,7 +7816,6 @@ int spider_oracle_handler::append_match_select(
DBUG_RETURN(0);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_oracle_handler::append_sum_select_part(
ulong sql_type,
const char *alias,
@ -7873,7 +7862,6 @@ int spider_oracle_handler::append_sum_select(
}
DBUG_RETURN(0);
}
#endif
void spider_oracle_handler::set_order_pos(
ulong sql_type
@ -7927,7 +7915,6 @@ void spider_oracle_handler::set_order_to_pos(
DBUG_VOID_RETURN;
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_oracle_handler::append_group_by_part(
const char *alias,
uint alias_length,
@ -7990,7 +7977,6 @@ int spider_oracle_handler::append_group_by(
}
DBUG_RETURN(0);
}
#endif
int spider_oracle_handler::append_key_order_for_merge_with_alias_part(
const char *alias,
@ -8036,14 +8022,12 @@ int spider_oracle_handler::append_key_order_for_merge_with_alias(
uint key_name_length;
DBUG_ENTER("spider_oracle_handler::append_key_order_for_merge_with_alias");
DBUG_PRINT("info",("spider this=%p", this));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (spider->result_list.direct_aggregate)
{
int error_num;
if ((error_num = append_group_by(str, alias, alias_length)))
DBUG_RETURN(error_num);
}
#endif
if (
spider->result_list.direct_order_limit ||
spider->result_list.internal_limit < 9223372036854775807LL ||
@ -8266,13 +8250,11 @@ int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias(
longlong offset_limit;
DBUG_ENTER("spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias");
DBUG_PRINT("info",("spider this=%p", this));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (spider->result_list.direct_aggregate)
{
if ((error_num = append_group_by(str, alias, alias_length)))
DBUG_RETURN(error_num);
}
#endif
spider_get_select_limit(spider, &select_lex, &select_limit,
&offset_limit);
if (
@ -8491,14 +8473,12 @@ int spider_oracle_handler::append_key_order_with_alias(
uint key_name_length;
DBUG_ENTER("spider_oracle_handler::append_key_order_with_alias");
DBUG_PRINT("info",("spider this=%p", this));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (spider->result_list.direct_aggregate)
{
int error_num;
if ((error_num = append_group_by(str, alias, alias_length)))
DBUG_RETURN(error_num);
}
#endif
if (
spider->result_list.direct_order_limit ||
spider->result_list.internal_limit < 9223372036854775807LL ||

View file

@ -125,7 +125,6 @@ public:
bool use_fields,
spider_fields *fields
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@ -135,7 +134,6 @@ public:
bool use_fields,
spider_fields *fields
);
#endif
size_t escape_string(
char *to,
const char *from,
@ -957,7 +955,6 @@ public:
const char *alias,
uint alias_length
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_sum_select_part(
ulong sql_type,
const char *alias,
@ -968,14 +965,12 @@ public:
const char *alias,
uint alias_length
);
#endif
void set_order_pos(
ulong sql_type
);
void set_order_to_pos(
ulong sql_type
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_group_by_part(
const char *alias,
uint alias_length,
@ -986,7 +981,6 @@ public:
const char *alias,
uint alias_length
);
#endif
int append_key_order_for_merge_with_alias_part(
const char *alias,
uint alias_length,

View file

@ -19,6 +19,4 @@
*/
#ifndef SPD_ENVIRON_INCLUDED
#define HANDLER_HAS_DIRECT_AGGREGATE
#endif /* SPD_ENVIRON_INCLUDED */

View file

@ -7840,9 +7840,7 @@ bool spider_check_direct_order_limit(
DBUG_PRINT("info",("spider with distinct"));
spider->result_list.direct_distinct = TRUE;
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.direct_aggregate = spider_param_direct_aggregate(thd);
#endif
DBUG_PRINT("info",("spider select_limit=%lld", select_limit));
DBUG_PRINT("info",("spider offset_limit=%lld", offset_limit));
if (
@ -7861,22 +7859,17 @@ bool spider_check_direct_order_limit(
DBUG_PRINT("info",("spider first_check is FALSE"));
first_check = FALSE;
spider->result_list.direct_distinct = FALSE;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.direct_aggregate = FALSE;
#endif
} else if (spider_db_append_condition(spider, NULL, 0, TRUE))
{
DBUG_PRINT("info",("spider FALSE by condition"));
first_check = FALSE;
spider->result_list.direct_distinct = FALSE;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.direct_aggregate = FALSE;
#endif
} else if (spider->sql_kinds & SPIDER_SQL_KIND_HANDLER)
{
DBUG_PRINT("info",("spider sql_kinds with SPIDER_SQL_KIND_HANDLER"));
spider->result_list.direct_distinct = FALSE;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.direct_aggregate = FALSE;
} else if (
!select_lex->group_list.elements &&
@ -7914,7 +7907,6 @@ bool spider_check_direct_order_limit(
first_check = FALSE;
spider->result_list.direct_distinct = FALSE;
}
#endif
}
longlong direct_order_limit = spider_param_direct_order_limit(thd,
@ -7926,10 +7918,8 @@ bool spider_check_direct_order_limit(
first_check ? "TRUE" : "FALSE"));
DBUG_PRINT("info",("spider (select_lex->options & OPTION_FOUND_ROWS)=%s",
select_lex && (select_lex->options & OPTION_FOUND_ROWS) ? "TRUE" : "FALSE"));
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
DBUG_PRINT("info",("spider direct_aggregate=%s",
spider->result_list.direct_aggregate ? "TRUE" : "FALSE"));
#endif
DBUG_PRINT("info",("spider select_lex->group_list.elements=%u",
select_lex ? select_lex->group_list.elements : 0));
DBUG_PRINT("info",("spider select_lex->with_sum_func=%s",
@ -7943,9 +7933,7 @@ bool spider_check_direct_order_limit(
!select_lex->explicit_limit ||
(select_lex->options & OPTION_FOUND_ROWS) ||
(
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
!spider->result_list.direct_aggregate &&
#endif
(
select_lex->group_list.elements ||
select_lex->with_sum_func
@ -7979,7 +7967,6 @@ bool spider_check_direct_order_limit(
DBUG_RETURN(FALSE);
}
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool spider_all_part_in_order(
ORDER *order,
TABLE *table
@ -8056,7 +8043,6 @@ Field *spider_field_exchange(
DBUG_PRINT("info",("spider out field=%p", field));
DBUG_RETURN(field);
}
#endif
int spider_set_direct_limit_offset(
ha_spider *spider
@ -8089,9 +8075,7 @@ int spider_set_direct_limit_offset(
if (
spider->wide_handler->sql_command != SQLCOM_SELECT ||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.direct_aggregate ||
#endif
spider->result_list.direct_order_limit ||
spider->prev_index_rnd_init != SPD_RND // must be RND_INIT and not be INDEX_INIT
)

View file

@ -431,7 +431,6 @@ bool spider_check_direct_order_limit(
ha_spider *spider
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool spider_all_part_in_order(
ORDER *order,
TABLE *table
@ -441,7 +440,6 @@ Field *spider_field_exchange(
handler *handler,
Field *field
);
#endif
int spider_set_direct_limit_offset(
ha_spider *spider