ndb - bug#24503

  Fix scan filter on bit types
  (note should probably be enabled in condition pushdown aswell)
parent d5e17a57
...@@ -136,7 +136,7 @@ NdbSqlUtil::m_typeList[] = { ...@@ -136,7 +136,7 @@ NdbSqlUtil::m_typeList[] = {
}, },
{ // 22 { // 22
Type::Bit, Type::Bit,
NULL, cmpBit,
NULL NULL
}, },
{ // 23 { // 23
...@@ -678,6 +678,26 @@ NdbSqlUtil::cmpText(const void* info, const void* p1, unsigned n1, const void* p ...@@ -678,6 +678,26 @@ NdbSqlUtil::cmpText(const void* info, const void* p1, unsigned n1, const void* p
return 0; 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 int
NdbSqlUtil::cmpTime(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full) 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 ...@@ -698,12 +718,6 @@ NdbSqlUtil::cmpTime(const void* info, const void* p1, unsigned n1, const void* p
} }
// not yet // 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 int
NdbSqlUtil::cmpLongvarchar(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full) NdbSqlUtil::cmpLongvarchar(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
......
...@@ -196,6 +196,7 @@ ...@@ -196,6 +196,7 @@
#define ZTRY_TO_UPDATE_ERROR 888 #define ZTRY_TO_UPDATE_ERROR 888
#define ZCALL_ERROR 890 #define ZCALL_ERROR 890
#define ZTEMPORARY_RESOURCE_FAILURE 891 #define ZTEMPORARY_RESOURCE_FAILURE 891
#define ZUNSUPPORTED_BRANCH 892
#define ZSTORED_SEIZE_ATTRINBUFREC_ERROR 873 // Part of Scan #define ZSTORED_SEIZE_ATTRINBUFREC_ERROR 873 // Part of Scan
......
...@@ -444,6 +444,11 @@ int Dbtup::TUPKEY_abort(Signal* signal, int error_type) ...@@ -444,6 +444,11 @@ int Dbtup::TUPKEY_abort(Signal* signal, int error_type)
}//if }//if
break; break;
case 40:
ljam();
terrorCode = ZUNSUPPORTED_BRANCH;
break;
default: default:
ndbrequire(false); ndbrequire(false);
break; break;
......
...@@ -1876,6 +1876,11 @@ int Dbtup::interpreterNextLab(Signal* signal, ...@@ -1876,6 +1876,11 @@ int Dbtup::interpreterNextLab(Signal* signal,
// NULL==NULL and NULL<not-NULL // NULL==NULL and NULL<not-NULL
res1 = r1_null && r2_null ? 0 : r1_null ? -1 : 1; res1 = r1_null && r2_null ? 0 : r1_null ? -1 : 1;
} else { } else {
jam();
if (unlikely(sqlType.m_cmp == 0))
{
return TUPKEY_abort(signal, 40);
}
res1 = (*sqlType.m_cmp)(cs, s1, attrLen, s2, argLen, true); res1 = (*sqlType.m_cmp)(cs, s1, attrLen, s2, argLen, true);
} }
} else { } else {
...@@ -1883,6 +1888,11 @@ int Dbtup::interpreterNextLab(Signal* signal, ...@@ -1883,6 +1888,11 @@ int Dbtup::interpreterNextLab(Signal* signal,
// NULL like NULL is true (has no practical use) // NULL like NULL is true (has no practical use)
res1 = r1_null && r2_null ? 0 : -1; res1 = r1_null && r2_null ? 0 : -1;
} else { } else {
jam();
if (unlikely(sqlType.m_like == 0))
{
return TUPKEY_abort(signal, 40);
}
res1 = (*sqlType.m_like)(cs, s1, attrLen, s2, argLen); res1 = (*sqlType.m_like)(cs, s1, attrLen, s2, argLen);
} }
} }
......
...@@ -278,6 +278,7 @@ ErrorBundle ErrorCodes[] = { ...@@ -278,6 +278,7 @@ ErrorBundle ErrorCodes[] = {
{ 885, AE, "Stack underflow in interpreter" }, { 885, AE, "Stack underflow in interpreter" },
{ 886, AE, "More than 65535 instructions executed 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)" }, { 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" }, { 4256, AE, "Must call Ndb::init() before this function" },
{ 4257, AE, "Tried to read too much - too many getValue calls" }, { 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