1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

A cleanup for MCOL-4064 Make JOIN collation aware

After creating and populating tables with CHAR(5) case insensitive columns,
in a set of consequent joins like:

select * from t1, t2 where t1.c1=t2.c1;
select * from t1, t2 where t1.c1=t2.c2;
select * from t1, t2 where t1.c2=t2.c1;
select * from t1, t2 where t1.c2=t2.c2;

only the first join worked reliably case insensitively.

Removing the remaining pieces of the code that used order_swap() to compare
short CHAR columns, and using Charset::strnncollsp() instead.
This fixes the issue.
This commit is contained in:
Alexander Barkov
2020-12-10 18:58:49 +04:00
parent 4da3d8b376
commit a433c65575
6 changed files with 49 additions and 63 deletions

View File

@ -30,6 +30,7 @@
#include "lbidlist.h"
#include "spinlock.h"
#include "vlarray.h"
#include "mcs_string.h"
using namespace std;
@ -1127,15 +1128,16 @@ void TupleJoiner::updateCPData(const Row& r)
if (r.isCharType(colIdx))
{
datatypes::Charset cs(r.getCharset(col));
int64_t val = r.getIntField(colIdx);
if (order_swap(val) < order_swap((int64_t) min) ||
if (datatypes::TCharShort::strnncollsp(cs, val, min) < 0 ||
((int64_t) min) == numeric_limits<int64_t>::max())
{
min = val;
}
if (order_swap(val) > order_swap((int64_t) max) ||
if (datatypes::TCharShort::strnncollsp(cs, val, max) > 0 ||
((int64_t) max) == numeric_limits<int64_t>::min())
{
max = val;

View File

@ -44,18 +44,6 @@
namespace joiner
{
inline uint64_t order_swap(uint64_t x)
{
return (x >> 56) |
((x << 40) & 0x00FF000000000000ULL) |
((x << 24) & 0x0000FF0000000000ULL) |
((x << 8) & 0x000000FF00000000ULL) |
((x >> 8) & 0x00000000FF000000ULL) |
((x >> 24) & 0x0000000000FF0000ULL) |
((x >> 40) & 0x000000000000FF00ULL) |
(x << 56);
}
class TypelessData
{
public: