Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-4850

Like predicate without wildcard doesn't pass the exact string if varchar columns has maxlength

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      William reported on https://community.hortonworks.com/questions/210582/like-query-in-phoenix.html that query is skipping all rows when length of the literal doesn't match with max lenght of the varchar column.

      Copied from above link:-

      When using a LIKE in a where clause, the rows are not found unless a wildcard(%) is added

      create table t ( ID VARCHAR(290) NOT NULL PRIMARY KEY, NAME VARCHAR(256));

      No rows affected (1.386 seconds) 0:

      jdbc:phoenix:> upsert into t values ('1','test');

      1 row affected (0.046 seconds) 0:

      jdbc:phoenix:> select * from t;

      ----------+

      ID NAME

      ----------+

      1 test

      ----------+

      1 row selected (0.05 seconds) 0:

      jdbc:phoenix:> select * from t where name like 'test';

      ----------+

      ID NAME

      ----------+

      ----------+

      No rows selected (0.016 seconds) 0:

      jdbc:phoenix:> select * from t where name like 'test%';

      ----------+

      ID NAME

      ----------+

      1 test

      ----------+

      1 row selected (0.032 seconds)

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            ankit@apache.org Ankit Singhal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: