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

ASF GitHub Bot commented on PHOENIX-514:
----------------------------------------

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

    https://github.com/apache/phoenix/pull/34#discussion_r23663726
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java ---
    @@ -881,7 +908,30 @@ public void readFields(DataInput input) throws 
IOException {
             }
             indexTableName = Bytes.readByteArray(input);
             dataEmptyKeyValueCF = Bytes.readByteArray(input);
    -        emptyKeyValueCFPtr = new 
ImmutableBytesPtr(Bytes.readByteArray(input));
    +        int len = WritableUtils.readVInt(input);
    +        //TODO remove this in the next major release
    +        boolean isNewClient = false;
    +        if (len < 0) {
    +          isNewClient = true;
    +          len=Math.abs(len);
    +        }
    +        byte [] emptyKeyValueCF = new byte[len];
    +        input.readFully(emptyKeyValueCF, 0, len);
    +        emptyKeyValueCFPtr = new ImmutableBytesPtr(emptyKeyValueCF);
    +        
    +        if (isNewClient) {
    +            int numIndexedExpressions = WritableUtils.readVInt(input);
    +            indexedExpressions = 
Sets.newLinkedHashSetWithExpectedSize(numIndexedExpressions);        
    +            for (int i = 0; i < numIndexedExpressions; i++) {
    +                   Expression expression = 
ExpressionType.values()[WritableUtils.readVInt(input)].newInstance();
    +                   expression.readFields(input);
    +                   indexedExpressions.add(expression);
    +            }
    +        }
    +        else {
    +            indexedExpressions = 
Sets.newLinkedHashSetWithExpectedSize(indexedColumnTypes.size());
    +            //TODO figure out how to create indexedExpressions
    --- End diff --
    
    I have to create a KeyValueColumnExpression for every column reference in 
indexedColumns, but this requires a PColumn 


> Support functional indexes
> --------------------------
>
>                 Key: PHOENIX-514
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-514
>             Project: Phoenix
>          Issue Type: Task
>            Reporter: James Taylor
>            Assignee: Thomas D'Silva
>              Labels: enhancement
>
> Instead of only defining the set of columns from the data table that make up 
> an index, you should be able to use expressions.  For example:
>       CREATE INDEX upper_last_name_idx ON person (UPPER(last_name))
> Then in queries that use UPPER(last_name), we can replace them with column 
> references to the index table.



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

Reply via email to