mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 14:03:07 +01:00
Fixed the accidentally broken merge join algorithm.
This commit is contained in:
parent
5d24054960
commit
1ca0ace21f
@ -250,31 +250,22 @@ bool MergeJoin::getRecord(thread_db* tdbb) const
|
||||
|
||||
MergeFile* const mfb = &tail->irsb_mrg_file;
|
||||
|
||||
HalfStaticArray<ULONG, 64> key;
|
||||
const USHORT smb_key_length = sort_rsb->getKeyLength();
|
||||
ULONG* const first_data = key.getBuffer(smb_key_length);
|
||||
const ULONG key_length = smb_key_length * sizeof(ULONG);
|
||||
UCharBuffer key;
|
||||
const ULONG key_length = sort_rsb->getKeyLength();
|
||||
UCHAR* const first_data = key.getBuffer(key_length);
|
||||
memcpy(first_data, getData(tdbb, mfb, 0), key_length);
|
||||
|
||||
SLONG record;
|
||||
while ((record = getRecord(tdbb, i)) >= 0)
|
||||
{
|
||||
const SLONG* p = (SLONG*) first_data;
|
||||
const SLONG* q = (SLONG*) getData(tdbb, mfb, record);
|
||||
bool equal = true;
|
||||
const UCHAR* p = first_data;
|
||||
const UCHAR* q = getData(tdbb, mfb, record);
|
||||
|
||||
for (USHORT count = smb_key_length; count; p++, q++, count--)
|
||||
if (memcmp(p, q, key_length))
|
||||
{
|
||||
if (*p != *q)
|
||||
{
|
||||
tail->irsb_mrg_last_fetched = record;
|
||||
equal = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!equal)
|
||||
tail->irsb_mrg_last_fetched = record;
|
||||
break;
|
||||
}
|
||||
|
||||
tail->irsb_mrg_equal_end = record;
|
||||
}
|
||||
|
@ -557,12 +557,12 @@ namespace Jrd
|
||||
m_next->setAnyBoolean(anyBoolean, ansiAny, ansiNot);
|
||||
}
|
||||
|
||||
USHORT getLength() const
|
||||
ULONG getLength() const
|
||||
{
|
||||
return m_map->length;
|
||||
}
|
||||
|
||||
USHORT getKeyLength() const
|
||||
ULONG getKeyLength() const
|
||||
{
|
||||
return m_map->keyLength;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user