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

James Taylor commented on PHOENIX-1273:
---------------------------------------

bq. is it not 2^n ranges instead of 2, where n is the length of the prefix?
That could be another way of doing it, but I was thinking to just generate two 
more that would cover all these. The LikeExpression still runs as a filter, so 
it'd filter out rows that didn't match but were in one of the two ranges. 
Depending on how long the prefix is, the 2^n solution might start degrading.

Need to add these overrides for serializing likeType in LikeExpression (unless 
I missed them?):
{code}
    @Override
    public void readFields(DataInput input) throws IOException {
        super.readFields(input);
        init();
        if (pattern == null) {
            try {
                likeType = LikeType.values()[WritableUtils.readVInt(input)];
            } catch (EOFException e) {
                likeType = LikeType.CASE_SENSITIVE;
            }
        }
    }

    @Override
    public void write(DataOutput output) throws IOException {
        super.write(output);
        if (pattern == null) {
            WritableUtils.writeVInt(output, likeType.ordinal());
        }
    }
{code}

Not absolutely essential, but an end2end test for ILIKE used in a WHERE clause 
in particular would be good. Bonus points for a test that uses a non literal 
pattern :-). Take a look at VariableLengthPKIT.testLikeOnColumn() if you want 
to copy/paste something similar?

> Phoenix should provide ILIKE keyword
> ------------------------------------
>
>                 Key: PHOENIX-1273
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1273
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.2
>            Reporter: Jean-Marc Spaggiari
>            Assignee: Jean-Marc Spaggiari
>            Priority: Minor
>         Attachments: PHOENIX-1273-v1.patch, PHOENIX-1273-v2.patch, 
> PHOENIX-1273-v3.patch, PHOENIX-1273.patch
>
>
> Phoenix provides LIKE keyword but not ILIKE which is a case insensitive LIKE. 
> Goal of this patch is to add this keyword.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to