[
https://issues.apache.org/jira/browse/PHOENIX-1038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14065461#comment-14065461
]
Jeffrey Zhong commented on PHOENIX-1038:
----------------------------------------
Seems you need to add "import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData".
In addition, it's better to use "SYSTEM_CATALOG_SCHEMA.equalsIgnoreCase"
instead of equals. Thanks.
Below is the code I'm using locally:
{noformat}
@@ -145,6 +145,7 @@ import org.apache.phoenix.schema.PDataType;
import org.apache.phoenix.schema.PIndexState;
import org.apache.phoenix.schema.PTableType;
import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
}
@lexer::header {
@@ -482,7 +483,7 @@ alter_index_node returns [AlterIndexStatement ret]
alter_table_node returns [AlterTableStatement ret]
: ALTER (TABLE | v=VIEW) t=from_table_name
( (DROP COLUMN (IF ex=EXISTS)? c=column_names) | (ADD (IF NOT
ex=EXISTS)? (d=column_defs) (p=properties)?) | (SET (p=properties)) )
- { PTableType tt = v==null ? PTableType.TABLE : PTableType.VIEW; ret =
( c == null ? factory.addColumn(factory.namedTable(null,t), tt, d, ex!=null, p)
: factory.dropColumn(
+ { PTableType tt = v==null ?
(PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA.equalsIgnoreCase(t.getSchemaName())
? PTableType.SYSTEM : PTableType.TABLE) : PTableType.VIEW; r
;
{noformat}
> Dynamically add INDEX_TYPE column to SYSTEM.CATALOG if not already there
> ------------------------------------------------------------------------
>
> Key: PHOENIX-1038
> URL: https://issues.apache.org/jira/browse/PHOENIX-1038
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: rajeshbabu
> Assignee: James Taylor
> Fix For: 5.0.0, 4.1
>
> Attachments: PHOENIX-1038.patch, PHOENIX-933.patch
>
>
> When a query involves more columns to project than columns in index and query
> condition involves leading columns in local index then first we can get
> matching rowkeys from local index table and then get the required columns
> from data table. In local index both data region and index region co-reside
> in the same RS, we can call get on data region to get the missing columns in
> the index, without any n/w overhead. So it's efficient.
--
This message was sent by Atlassian JIRA
(v6.2#6252)