Commit 92678f27 authored by unknown's avatar unknown

ndb - bug#24503

  Fix scan filter on bit types
  (note should probably be enabled in condition pushdown aswell)


ndb/src/common/util/NdbSqlUtil.cpp:
  Add support for comparing bit types
ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
  Add new error code
ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp:
  Add new error code
ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  Add correct handling of unsupported type
ndb/src/ndbapi/ndberror.c:
  Add new error code
parent 5eacdd18
......@@ -136,7 +136,7 @@ NdbSqlUtil::m_typeList[] = {
},
{ // 22
Type::Bit,
NULL,
cmpBit,
NULL
},
{ // 23
......@@ -678,6 +678,26 @@ NdbSqlUtil::cmpText(const void* info, const void* p1, unsigned n1, const void* p
return 0;
}
int
NdbSqlUtil::cmpBit(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{
Uint32 n = (n1 < n2) ? n1 : n2;
char* c1 = (char*)p1;
char* c2 = (char*)p2;
int ret = memcmp(p1, p2, n);
printf(" p1: ");
for (Uint32 i = 0; i<n1; i++)
printf("%d ", c1[i]);
printf(" p2: ");
for (Uint32 i = 0; i<n2; i++)
printf("%d ", c2[i]);
ndbout_c(" -> %d", ret);
return ret;
}
int
NdbSqlUtil::cmpTime(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{
......@@ -698,12 +718,6 @@ NdbSqlUtil::cmpTime(const void* info, const void* p1, unsigned n1, const void* p
}
// not yet
int
NdbSqlUtil::cmpBit(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{
assert(false);
return 0;
}
int
NdbSqlUtil::cmpLongvarchar(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
......
......@@ -196,6 +196,7 @@
#define ZTRY_TO_UPDATE_ERROR 888
#define ZCALL_ERROR 890
#define ZTEMPORARY_RESOURCE_FAILURE 891
#define ZUNSUPPORTED_BRANCH 892
#define ZSTORED_SEIZE_ATTRINBUFREC_ERROR 873 // Part of Scan
......
......@@ -444,6 +444,11 @@ int Dbtup::TUPKEY_abort(Signal* signal, int error_type)
}//if
break;
case 40:
ljam();
terrorCode = ZUNSUPPORTED_BRANCH;
break;
default:
ndbrequire(false);
break;
......
......@@ -1876,6 +1876,11 @@ int Dbtup::interpreterNextLab(Signal* signal,
// NULL==NULL and NULL<not-NULL
res1 = r1_null && r2_null ? 0 : r1_null ? -1 : 1;
} else {
jam();
if (unlikely(sqlType.m_cmp == 0))
{
return TUPKEY_abort(signal, 40);
}
res1 = (*sqlType.m_cmp)(cs, s1, attrLen, s2, argLen, true);
}
} else {
......@@ -1883,6 +1888,11 @@ int Dbtup::interpreterNextLab(Signal* signal,
// NULL like NULL is true (has no practical use)
res1 = r1_null && r2_null ? 0 : -1;
} else {
jam();
if (unlikely(sqlType.m_like == 0))
{
return TUPKEY_abort(signal, 40);
}
res1 = (*sqlType.m_like)(cs, s1, attrLen, s2, argLen);
}
}
......
......@@ -278,6 +278,7 @@ ErrorBundle ErrorCodes[] = {
{ 885, AE, "Stack underflow in interpreter" },
{ 886, AE, "More than 65535 instructions executed in interpreter" },
{ 897, AE, "Update attempt of primary key via ndbcluster internal api (if this occurs via the MySQL server it is a bug, please report)" },
{ 892, AE, "Unsupported type in scan filter" },
{ 4256, AE, "Must call Ndb::init() before this function" },
{ 4257, AE, "Tried to read too much - too many getValue calls" },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment