phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-514) Support functional indexes
Date Wed, 28 Jan 2015 18:42:34 GMT

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

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

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

    https://github.com/apache/phoenix/pull/34#discussion_r23710801
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java ---
    @@ -326,6 +326,49 @@ private IndexMaintainer(PTable dataTable, PTable index) {
             // TODO: check whether index is immutable or not. Currently it's always false
so checking
             // data table is with immutable rows or not.
             this.immutableRows = dataTable.isImmutableRows();
    +        int indexColByteSize = 0;
    +        for (int i = indexPosOffset; i < index.getPKColumns().size(); i++) {
    +            PColumn indexColumn = index.getPKColumns().get(i);
    +            int indexPos = i - indexPosOffset;
    +            Expression expression = null;
    +            try {
    +                ParseNode parseNode  = SQLParser.parseCondition(indexColumn.getExpressionStr());
    +                ColumnResolver resolver = FromCompiler.getResolver(new TableRef(dataTable));
    +                StatementContext context = new StatementContext(new PhoenixStatement(connection),
resolver);
    +                expression = parseNode.accept(new ExpressionCompiler(context));
    --- End diff --
    
    If the null check idea above won't work, instead of the instanceof check below, can you
track in the ExpressionCompiler if you've compiled an expression versus only a column that
maps to the PK column in the data table? You could specialize the resolveColumn method of
your ExpressionCompiler and check visitor.isTopLevel() and SchemaUtil.isPKColumn(IndexUtil.getDataColumn(dataTable,
indexColumn.getName().getString()))


> 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)

Mime
View raw message