Bug #19612819 : FILESORT: ASSERTION FAILED: POS->FIELD != 0 || POS->ITEM != 0
Problem: While getting the temp table field for a REF_ITEM make_sortorder is using the real_item. As a result server fails later with an assert. Solution: Do not use real_item to get the temp table field. Instead use the REF_ITEM itself as temp table fields are created for REF_ITEM not the real_item.
This commit is contained in:
parent
ddd275bde7
commit
1a5b8122b6
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -14649,18 +14649,33 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length,
|
||||
|
||||
for (;order;order=order->next,pos++)
|
||||
{
|
||||
Item *item= order->item[0]->real_item();
|
||||
Item *const item= order->item[0], *const real_item= item->real_item();
|
||||
pos->field= 0; pos->item= 0;
|
||||
if (item->type() == Item::FIELD_ITEM)
|
||||
pos->field= ((Item_field*) item)->field;
|
||||
else if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item())
|
||||
pos->field= ((Item_sum*) item)->get_tmp_table_field();
|
||||
else if (item->type() == Item::COPY_STR_ITEM)
|
||||
{ // Blob patch
|
||||
pos->item= ((Item_copy*) item)->get_item();
|
||||
if (real_item->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
// Could be a field, or Item_direct_view_ref wrapping a field
|
||||
DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
|
||||
(item->type() == Item::REF_ITEM &&
|
||||
static_cast<Item_ref*>(item)->ref_type() ==
|
||||
Item_ref::VIEW_REF));
|
||||
pos->field= static_cast<Item_field*>(real_item)->field;
|
||||
}
|
||||
else if (real_item->type() == Item::SUM_FUNC_ITEM &&
|
||||
!real_item->const_item())
|
||||
{
|
||||
// Aggregate, or Item_aggregate_ref
|
||||
DBUG_ASSERT(item->type() == Item::SUM_FUNC_ITEM ||
|
||||
(item->type() == Item::REF_ITEM &&
|
||||
static_cast<Item_ref*>(item)->ref_type() ==
|
||||
Item_ref::AGGREGATE_REF));
|
||||
pos->field= item->get_tmp_table_field();
|
||||
}
|
||||
else if (real_item->type() == Item::COPY_STR_ITEM)
|
||||
{ // Blob patch
|
||||
pos->item= static_cast<Item_copy*>(real_item)->get_item();
|
||||
}
|
||||
else
|
||||
pos->item= *order->item;
|
||||
pos->item= item;
|
||||
pos->reverse=! order->asc;
|
||||
}
|
||||
*length=count;
|
||||
|
Loading…
x
Reference in New Issue
Block a user