mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:43:02 +01:00
Restore the manual sorting, as qsort() sorts equal values differently across Windows and Linux
This commit is contained in:
parent
1f36112fb4
commit
d6179920c0
@ -121,20 +121,21 @@ void InnerJoin::calculateStreamInfo()
|
||||
// Unless PLAN is enforced, sort the streams based on independency and cost
|
||||
if (!plan && (innerStreams.getCount() > 1))
|
||||
{
|
||||
auto compare = [] (const void* a, const void* b)
|
||||
StreamInfoList tempStreams;
|
||||
|
||||
for (const auto innerStream : innerStreams)
|
||||
{
|
||||
const auto first = *static_cast<const StreamInfo* const*>(a);
|
||||
const auto second = *static_cast<const StreamInfo* const*>(b);
|
||||
FB_SIZE_T index = 0;
|
||||
for (; index < tempStreams.getCount(); index++)
|
||||
{
|
||||
if (StreamInfo::cheaperThan(innerStream, tempStreams[index]))
|
||||
break;
|
||||
}
|
||||
tempStreams.insert(index, innerStream);
|
||||
}
|
||||
|
||||
if (StreamInfo::cheaperThan(first, second))
|
||||
return -1;
|
||||
if (StreamInfo::cheaperThan(second, first))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
qsort(innerStreams.begin(), innerStreams.getCount(), sizeof(StreamInfo*), compare);
|
||||
// Finally update the innerStreams with the sorted streams
|
||||
innerStreams = tempStreams;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user