Don't try to optimize IsNot

Doesn't handle NULLs correctly, will open separate ticket
for it. Fixes the IS NOT case of #26
This commit is contained in:
Colin Dellow 2018-07-04 18:59:16 -04:00
parent 0aa98ae1a5
commit 373616ad1e
1 changed files with 7 additions and 7 deletions

View File

@ -124,7 +124,6 @@ bool ParquetCursor::currentRowGroupSatisfiesBlobFilter(Constraint& constraint, s
&blob[0], &blob[0],
&blob[0] + blob.size()); &blob[0] + blob.size());
} }
case IsNot:
case NotEqual: case NotEqual:
{ {
// If min == max == blob, we can skip this. // If min == max == blob, we can skip this.
@ -132,6 +131,7 @@ bool ParquetCursor::currentRowGroupSatisfiesBlobFilter(Constraint& constraint, s
bool minMaxEqual = minLen == maxLen && memcmp(minPtr, maxPtr, minLen) == 0; bool minMaxEqual = minLen == maxLen && memcmp(minPtr, maxPtr, minLen) == 0;
return !(blobMaxEqual && minMaxEqual); return !(blobMaxEqual && minMaxEqual);
} }
case IsNot:
default: default:
return true; return true;
} }
@ -168,7 +168,6 @@ bool ParquetCursor::currentRowGroupSatisfiesTextFilter(Constraint& constraint, s
return minStr < str; return minStr < str;
case LessThanOrEqual: case LessThanOrEqual:
return minStr <= str; return minStr <= str;
case IsNot:
case NotEqual: case NotEqual:
// If min == max == str, we can skip this. // If min == max == str, we can skip this.
return !(minStr == maxStr && str == minStr); return !(minStr == maxStr && str == minStr);
@ -179,6 +178,7 @@ bool ParquetCursor::currentRowGroupSatisfiesTextFilter(Constraint& constraint, s
std::string truncatedMax = maxStr.substr(0, likeStringValue.size()); std::string truncatedMax = maxStr.substr(0, likeStringValue.size());
return likeStringValue.empty() || (likeStringValue >= truncatedMin && likeStringValue <= truncatedMax); return likeStringValue.empty() || (likeStringValue >= truncatedMin && likeStringValue <= truncatedMax);
} }
case IsNot:
default: default:
return true; return true;
} }
@ -260,11 +260,11 @@ bool ParquetCursor::currentRowGroupSatisfiesIntegerFilter(Constraint& constraint
return min < value; return min < value;
case LessThanOrEqual: case LessThanOrEqual:
return min <= value; return min <= value;
case IsNot:
case NotEqual: case NotEqual:
// If min == max == str, we can skip this. // If min == max == str, we can skip this.
return !(min == max && value == min); return !(min == max && value == min);
case Like: case Like:
case IsNot:
default: default:
return true; return true;
} }
@ -323,11 +323,11 @@ bool ParquetCursor::currentRowGroupSatisfiesDoubleFilter(Constraint& constraint,
return min < value; return min < value;
case LessThanOrEqual: case LessThanOrEqual:
return min <= value; return min <= value;
case IsNot:
case NotEqual: case NotEqual:
// If min == max == str, we can skip this. // If min == max == str, we can skip this.
return !(min == max && value == min); return !(min == max && value == min);
case Like: case Like:
case IsNot:
default: default:
return true; return true;
} }
@ -354,7 +354,6 @@ bool ParquetCursor::currentRowSatisfiesTextFilter(Constraint& constraint) {
return 0 == memcmp(&blob[0], ba->ptr, ba->len); return 0 == memcmp(&blob[0], ba->ptr, ba->len);
} }
case IsNot:
case NotEqual: case NotEqual:
{ {
const std::vector<unsigned char>& blob = constraint.blobValue; const std::vector<unsigned char>& blob = constraint.blobValue;
@ -419,6 +418,7 @@ bool ParquetCursor::currentRowSatisfiesTextFilter(Constraint& constraint) {
len = likeStringValue.size(); len = likeStringValue.size();
return 0 == memcmp(&likeStringValue[0], ba->ptr, len); return 0 == memcmp(&likeStringValue[0], ba->ptr, len);
} }
case IsNot:
default: default:
return true; return true;
} }
@ -458,7 +458,6 @@ bool ParquetCursor::currentRowSatisfiesIntegerFilter(Constraint& constraint) {
case Is: case Is:
case Equal: case Equal:
return constraintValue == value; return constraintValue == value;
case IsNot:
case NotEqual: case NotEqual:
return constraintValue != value; return constraintValue != value;
case GreaterThan: case GreaterThan:
@ -470,6 +469,7 @@ bool ParquetCursor::currentRowSatisfiesIntegerFilter(Constraint& constraint) {
case LessThanOrEqual: case LessThanOrEqual:
return value <= constraintValue; return value <= constraintValue;
case Like: case Like:
case IsNot:
default: default:
return true; return true;
} }
@ -490,7 +490,6 @@ bool ParquetCursor::currentRowSatisfiesDoubleFilter(Constraint& constraint) {
case Is: case Is:
case Equal: case Equal:
return constraintValue == value; return constraintValue == value;
case IsNot:
case NotEqual: case NotEqual:
return constraintValue != value; return constraintValue != value;
case GreaterThan: case GreaterThan:
@ -502,6 +501,7 @@ bool ParquetCursor::currentRowSatisfiesDoubleFilter(Constraint& constraint) {
case LessThanOrEqual: case LessThanOrEqual:
return value <= constraintValue; return value <= constraintValue;
case Like: case Like:
case IsNot:
default: default:
return true; return true;
} }