-
Notifications
You must be signed in to change notification settings - Fork 150
[TRAFODION-2791] 'Not casespecific' column comparison returns wrong #1307
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -350,6 +350,14 @@ class ConstValue : public ItemExpr | |
| NAMemory * outHeap = CmpCommon::statementHeap() | ||
| ); | ||
|
|
||
| ConstValue(const NAString& strval, | ||
| NABoolean isCaseInSensitive, | ||
| enum CharInfo::CharSet charSet=CharInfo::DefaultCharSet, | ||
| enum CharInfo::Collation collation=CharInfo::DefaultCollation, | ||
| enum CharInfo::Coercibility coercibility=CharInfo::COERCIBLE, | ||
| NAMemory * outHeap = CmpCommon::statementHeap() | ||
| ); | ||
|
|
||
| // constructor for a wide (unicode) string constant | ||
| ConstValue(const NAWString& strval, | ||
| enum CharInfo::CharSet charSet=CharInfo::UNICODE, | ||
|
|
@@ -359,6 +367,16 @@ class ConstValue : public ItemExpr | |
| enum CharInfo::CharSet strLitPrefixCharSet=CharInfo::UnknownCharSet | ||
| ); | ||
|
|
||
| ConstValue(const NAWString& strval, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment here. |
||
| NABoolean isCaseInSensitive, | ||
| enum CharInfo::CharSet charSet=CharInfo::UNICODE, | ||
| enum CharInfo::Collation collation=CharInfo::DefaultCollation, | ||
| enum CharInfo::Coercibility coercibility=CharInfo::COERCIBLE, | ||
| NAMemory * outHeap = CmpCommon::statementHeap(), | ||
| enum CharInfo::CharSet strLitPrefixCharSet=CharInfo::UnknownCharSet | ||
| ); | ||
|
|
||
|
|
||
| // constructor for a string constant with unknown charset (both the | ||
| // single-byte and double-byte string values are known) | ||
| ConstValue( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -503,7 +503,13 @@ ConstValue* OptRangeSpec::getConstOperand(ItemExpr* predExpr, Lng32 constInx) | |
| // currently support. Predicates involving types not yet supported will be | ||
| // treated as residual predicates. | ||
| if (QRDescGenerator::typeSupported(static_cast<ConstValue*>(right)->getType())) | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds a case-insensitive flag to the type in the RangeSpec, but I don't think RangeSpecs are written to handle case-insensitive comparisons. Take a look at the methods that deal with comparisons when building RangeSpecs, in file Range.cpp. So, I think you would have to do one of two things: a) disable the RangeSpec transformation for case-insensitive comparison operators (the easy way) or b) change the RangeSpec methods to handle case-insensitive comparisons.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do those operators in order to add case-insensitive to new constvalue.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RangeSpecs keep a list of points and intervals and these intervals need to be ordered, otherwise RangeSpec doesn't work. If we have case-insensitive comparison, that ordering needs to be different, but as far as I could tell, there is no code at the moment that would do a case-insensitive ordering of the values. |
||
| /* add constvalue ‘not casespecific’ to type_*/ | ||
| ((CharType*)getType())->setCaseinsensitive( | ||
| ((CharType *)(((ConstValue*)(right))->getType()))->isCaseinsensitive()); | ||
|
|
||
| return static_cast<ConstValue*>(right); | ||
| } | ||
| else | ||
| return NULL; | ||
| } // getConstOperand() | ||
|
|
@@ -1712,10 +1718,13 @@ ItemExpr* OptRangeSpec::makeSubrangeItemExpr(SubrangeBase* subrange, | |
| (Subrange<RangeWString>*)subrange; | ||
| if (parentOfStart) | ||
| parentOfStart->child(1) = | ||
| new(mvqrHeap_) ConstValue(wcharSubrange->start); | ||
| new(mvqrHeap_) ConstValue(wcharSubrange->start, | ||
| ((CharType *)type)->isCaseinsensitive()); | ||
|
|
||
| if (parentOfEnd) | ||
| parentOfEnd->child(1) = | ||
| new(mvqrHeap_) ConstValue(wcharSubrange->end); | ||
| new(mvqrHeap_) ConstValue(wcharSubrange->end, | ||
| ((CharType *)type)->isCaseinsensitive()); | ||
| } | ||
| else | ||
| { | ||
|
|
@@ -1724,10 +1733,15 @@ ItemExpr* OptRangeSpec::makeSubrangeItemExpr(SubrangeBase* subrange, | |
| = (Subrange<RangeString>*)subrange; | ||
| if (parentOfStart) | ||
| parentOfStart->child(1) = | ||
| new(mvqrHeap_) ConstValue(charSubrange->start, ((CharType *)type)->getCharSet() ); | ||
| new(mvqrHeap_) ConstValue(charSubrange->start, | ||
| ((CharType *)type)->isCaseinsensitive(), | ||
| ((CharType *)type)->getCharSet() ); | ||
|
|
||
| if (parentOfEnd) | ||
| parentOfEnd->child(1) = | ||
| new(mvqrHeap_) ConstValue(charSubrange->end, ((CharType *)type)->getCharSet() ); | ||
| new(mvqrHeap_) ConstValue(charSubrange->end, | ||
| ((CharType *)type)->isCaseinsensitive(), | ||
| ((CharType *)type)->getCharSet() ); | ||
| } | ||
| } | ||
| break; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding another constructor, I would suggest to add an optional argument isCaseInSensitive to the previous constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first, I think isCaseInSensitive is a import attribute,
second, i don't think add this argument to the end of constructor is a good way.
if add this argument in the second position, it will change some code where call it.
so i add a new constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you need to add it as the last argument of the existing constructors.