[ 
https://issues.apache.org/jira/browse/TRAFODION-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16268211#comment-16268211
 ] 

ASF GitHub Bot commented on TRAFODION-2791:
-------------------------------------------

Github user duoluodexiaokeke commented on a diff in the pull request:

    
https://github.com/apache/incubator-trafodion/pull/1307#discussion_r153405510
  
    --- Diff: core/sql/optimizer/ItemColRef.h ---
    @@ -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()
    +        );
    --- End diff --
    
    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.


> 'Not casespecific' column comparison returns wrong results
> ----------------------------------------------------------
>
>                 Key: TRAFODION-2791
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2791
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-cmp
>    Affects Versions: 2.3-incubating
>         Environment: All
>            Reporter: David Wayne Birdsall
>
> The current support of 'not casespecific' columns seems to be a bit 
> erroneous. As shown below, c1 is a 'not casespecific' char column with a 
> value of a upper case 'A', and c2 a 'not casespecific' char column with a 
> value of a lower case 'a'.
> The following predicates seem to work:
> t.c1='a' (not casespecific)
> t.c1<='a' (not casespecific)
> t.c1 in ('a' (not casespecific))
> But the following predicates don't seem to work. They don't find the match 
> while they should have in a case insensitive comparison.
> t.c1<>'a' (not casespecific)
> t.c1>='a' (not casespecific)
> t.c1 between 'a' (not casespecific) and 'b' (not casespecific)
> t.c1 like '%a%' (not casespecific)
> t.c1=t.c2
> For example:
> >>drop table if exists t;
> --- SQL operation complete.
> >>
> >>create table t (c1 char not casespecific, c2 char not casespecific);
> --- SQL operation complete.
> >>insert into t values ('A', 'a');
> --- 1 row(s) inserted.
> >>select * from t;
> C1 C2
> -- --
> A a
> --- 1 row(s) selected.
> >>select * from t where t.c1='a' (not casespecific);
> C1 C2
> -- --
> a a
> --- 1 row(s) selected.
> >>select * from t where t.c1<='a' (not casespecific);
> C1 C2
> -- --
> A a
> --- 1 row(s) selected.
> >>select * from t where t.c1<>'a' (not casespecific);
> C1 C2
> -- --
> A a
> --- 1 row(s) selected.
> >>select * from t where t.c1>='a' (not casespecific);
> --- 0 row(s) selected.
> >>select * from t where t.c1 between 'a' (not casespecific) and 'b' (not 
> >>casespecific);
> --- 0 row(s) selected.
> >>select * from t where t.c1 in ('a' (not casespecific));
> C1 C2
> -- --
> a a
> --- 1 row(s) selected.
> >>select * from t where t.c1 like '%a%' (not casespecific);
> --- 0 row(s) selected.
> >>select * from t where t.c1=t.c2;
> --- 0 row(s) selected.
> >>
> >>drop table t;
> --- SQL operation complete.
> To reproduce, use the following script:
> drop table if exists t;
> create table t (c1 char not casespecific, c2 char not casespecific);
> insert into t values ('A', 'a');
> select * from t;
> select * from t where t.c1='a' (not casespecific);
> select * from t where t.c1<='a' (not casespecific);
> select * from t where t.c1<>'a' (not casespecific);
> select * from t where t.c1>='a' (not casespecific);
> select * from t where t.c1 between 'a' (not casespecific) and 'b' (not 
> casespecific);
> select * from t where t.c1 in ('a' (not casespecific));
> select * from t where t.c1 like '%a%' (not casespecific);
> select * from t where t.c1=t.c2;
> drop table t;



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to