[ https://issues.apache.org/jira/browse/PHOENIX-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14295759#comment-14295759 ]
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_r23718870 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java --- @@ -976,20 +1043,33 @@ private void initCachedState() { ref.getFamily(), ref.getQualifier()))); } - this.allColumns = Sets.newLinkedHashSetWithExpectedSize(indexedColumns.size() + coveredColumns.size()); + this.allColumns = Sets.newLinkedHashSetWithExpectedSize(indexedExpressions.size() + coveredColumns.size()); + // columns that are required to evaluate all expressions in indexedExpressions (not including columns in data row key) + this.indexedColumns = Sets.newLinkedHashSetWithExpectedSize(indexedExpressions.size()); + for (Expression expression : indexedExpressions) { + KeyValueExpressionVisitor visitor = new KeyValueExpressionVisitor() { + @Override + public Void visit(KeyValueColumnExpression expression) { + indexedColumns.add(new ColumnReference(expression.getColumnFamily(), expression.getColumnName())); + indexedColumnTypes.add(expression.getDataType()); --- End diff -- If I don't initialize indexedColumnTypes here, I would need to initialize it in the constructor , so I would have to duplicate the loop over expressions and calling KeyValueExpressionVisitor in the constructor. > 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)