You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
Merge pull request #1827 from cvicentiu/fetch-first-refactor
MCOL-4645 Update columnstore usage of select_lex
This commit is contained in:
@ -6787,17 +6787,17 @@ int processLimitAndOffset(
|
|||||||
*/
|
*/
|
||||||
if (gwi.subSelectType != CalpontSelectExecutionPlan::IN_SUBS
|
if (gwi.subSelectType != CalpontSelectExecutionPlan::IN_SUBS
|
||||||
&& gwi.subSelectType != CalpontSelectExecutionPlan::EXISTS_SUBS
|
&& gwi.subSelectType != CalpontSelectExecutionPlan::EXISTS_SUBS
|
||||||
&& select_lex.master_unit()->global_parameters()->explicit_limit)
|
&& select_lex.master_unit()->global_parameters()->limit_params.explicit_limit)
|
||||||
{
|
{
|
||||||
if (select_lex.master_unit()->global_parameters()->offset_limit)
|
if (select_lex.master_unit()->global_parameters()->limit_params.offset_limit)
|
||||||
{
|
{
|
||||||
Item_int* offset = (Item_int*)select_lex.master_unit()->global_parameters()->offset_limit;
|
Item_int* offset = (Item_int*)select_lex.master_unit()->global_parameters()->limit_params.offset_limit;
|
||||||
csep->limitStart(offset->val_int());
|
csep->limitStart(offset->val_int());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (select_lex.master_unit()->global_parameters()->select_limit)
|
if (select_lex.master_unit()->global_parameters()->limit_params.select_limit)
|
||||||
{
|
{
|
||||||
Item_int* select = (Item_int*)select_lex.master_unit()->global_parameters()->select_limit;
|
Item_int* select = (Item_int*)select_lex.master_unit()->global_parameters()->limit_params.select_limit;
|
||||||
csep->limitNum(select->val_int());
|
csep->limitNum(select->val_int());
|
||||||
// MCOL-894 Activate parallel ORDER BY
|
// MCOL-894 Activate parallel ORDER BY
|
||||||
csep->orderByThreads(get_orderby_threads(gwi.thd));
|
csep->orderByThreads(get_orderby_threads(gwi.thd));
|
||||||
@ -6805,19 +6805,19 @@ int processLimitAndOffset(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// union with explicit select at the top level
|
// union with explicit select at the top level
|
||||||
else if (isUnion && select_lex.explicit_limit)
|
else if (isUnion && select_lex.limit_params.explicit_limit)
|
||||||
{
|
{
|
||||||
if (select_lex.braces)
|
if (select_lex.braces)
|
||||||
{
|
{
|
||||||
if (select_lex.offset_limit)
|
if (select_lex.limit_params.offset_limit)
|
||||||
csep->limitStart(((Item_int*)select_lex.offset_limit)->val_int());
|
csep->limitStart(((Item_int*)select_lex.limit_params.offset_limit)->val_int());
|
||||||
|
|
||||||
if (select_lex.select_limit)
|
if (select_lex.limit_params.select_limit)
|
||||||
csep->limitNum(((Item_int*)select_lex.select_limit)->val_int());
|
csep->limitNum(((Item_int*)select_lex.limit_params.select_limit)->val_int());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// other types of queries that have explicit LIMIT
|
// other types of queries that have explicit LIMIT
|
||||||
else if (select_lex.explicit_limit)
|
else if (select_lex.limit_params.explicit_limit)
|
||||||
{
|
{
|
||||||
uint32_t limitOffset = 0;
|
uint32_t limitOffset = 0;
|
||||||
|
|
||||||
@ -6827,15 +6827,15 @@ int processLimitAndOffset(
|
|||||||
|
|
||||||
// @bug5729. After upgrade, join->unit sometimes is uninitialized pointer
|
// @bug5729. After upgrade, join->unit sometimes is uninitialized pointer
|
||||||
// (not null though) and will cause seg fault. Prefer checking
|
// (not null though) and will cause seg fault. Prefer checking
|
||||||
// select_lex->offset_limit if not null.
|
// select_lex->limit_params.offset_limit if not null.
|
||||||
if (join->select_lex &&
|
if (join->select_lex &&
|
||||||
join->select_lex->offset_limit &&
|
join->select_lex->limit_params.offset_limit &&
|
||||||
join->select_lex->offset_limit->is_fixed() &&
|
join->select_lex->limit_params.offset_limit->is_fixed() &&
|
||||||
join->select_lex->select_limit &&
|
join->select_lex->limit_params.select_limit &&
|
||||||
join->select_lex->select_limit->is_fixed())
|
join->select_lex->limit_params.select_limit->is_fixed())
|
||||||
{
|
{
|
||||||
limitOffset = join->select_lex->offset_limit->val_int();
|
limitOffset = join->select_lex->limit_params.offset_limit->val_int();
|
||||||
limitNum = join->select_lex->select_limit->val_int();
|
limitNum = join->select_lex->limit_params.select_limit->val_int();
|
||||||
}
|
}
|
||||||
else if (join->unit)
|
else if (join->unit)
|
||||||
{
|
{
|
||||||
@ -6845,15 +6845,15 @@ int processLimitAndOffset(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (select_lex.master_unit()->global_parameters()->offset_limit)
|
if (select_lex.master_unit()->global_parameters()->limit_params.offset_limit)
|
||||||
{
|
{
|
||||||
Item_int* offset = (Item_int*)select_lex.master_unit()->global_parameters()->offset_limit;
|
Item_int* offset = (Item_int*)select_lex.master_unit()->global_parameters()->limit_params.offset_limit;
|
||||||
limitOffset = offset->val_int();
|
limitOffset = offset->val_int();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (select_lex.master_unit()->global_parameters()->select_limit)
|
if (select_lex.master_unit()->global_parameters()->limit_params.select_limit)
|
||||||
{
|
{
|
||||||
Item_int* select = (Item_int*)select_lex.master_unit()->global_parameters()->select_limit;
|
Item_int* select = (Item_int*)select_lex.master_unit()->global_parameters()->limit_params.select_limit;
|
||||||
limitNum = select->val_int();
|
limitNum = select->val_int();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10006,8 +10006,8 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
|||||||
// LIMIT and OFFSET are extracted from TABLE_LIST elements.
|
// LIMIT and OFFSET are extracted from TABLE_LIST elements.
|
||||||
// All of JOIN-ed tables contain relevant limit and offset.
|
// All of JOIN-ed tables contain relevant limit and offset.
|
||||||
uint64_t limit = (uint64_t)-1;
|
uint64_t limit = (uint64_t)-1;
|
||||||
if (gi.groupByTables->select_lex->select_limit &&
|
if (gi.groupByTables->select_lex->limit_params.select_limit &&
|
||||||
( limit = static_cast<Item_int*>(gi.groupByTables->select_lex->select_limit)->val_int() ) &&
|
( limit = static_cast<Item_int*>(gi.groupByTables->select_lex->limit_params.select_limit)->val_int() ) &&
|
||||||
limit != (uint64_t)-1 )
|
limit != (uint64_t)-1 )
|
||||||
{
|
{
|
||||||
csep->limitNum(limit);
|
csep->limitNum(limit);
|
||||||
@ -10019,9 +10019,9 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
|||||||
csep->limitNum((uint64_t) - 2);
|
csep->limitNum((uint64_t) - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gi.groupByTables->select_lex->offset_limit)
|
if (gi.groupByTables->select_lex->limit_params.offset_limit)
|
||||||
{
|
{
|
||||||
csep->limitStart(((Item_int*)gi.groupByTables->select_lex->offset_limit)->val_int());
|
csep->limitStart(((Item_int*)gi.groupByTables->select_lex->limit_params.offset_limit)->val_int());
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't currently support limit with correlated subquery
|
// We don't currently support limit with correlated subquery
|
||||||
|
Reference in New Issue
Block a user