[
https://issues.apache.org/jira/browse/PHOENIX-1560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14279294#comment-14279294
]
James Taylor commented on PHOENIX-1560:
---------------------------------------
Thanks for the updates, [~maryannxue].
- As far as the testGlobalIndexOptimizationOnSharedIndex, we'd want to see the
shared index being used, which I think will say something like a reference to a
scan over _IDX_T (which is the name of the physical HBase table that stores
indexes for views on T). For example, see BaseViewIT.testUpdatableViewIndex().
For this test, how about something like this:
{code}
create table t (t_id VARCHAR, k1 INTEGER, k2 INTEGER, v1 VARCHAR, CONSTRAINT pk
PRIMARY KEY (t_id, k1, k2));
create view v as select * from t where t_id = 'foo';
create index i on v(v1);
select /*+ index(v i) */ k1, k2 from v where v1='bar'; // Should use shared
index
{code}
- Not a big deal, but why is this change necessary? What happens if you let the
IN become an equality?
{code}
@ -58,12 +58,16 @@ public class InListExpression extends BaseSingleExpression {
private List<Expression> keyExpressions; // client side only
public static Expression create (List<Expression> children, boolean
isNegate, ImmutableBytesWritable ptr) throws SQLException {
+ return create(children, isNegate, ptr, true);
+ }
+
+ public static Expression create (List<Expression> children, boolean
isNegate, ImmutableBytesWritable ptr, boolean allowShortcut) throws
SQLException {
Expression firstChild = children.get(0);
if (firstChild.isStateless() && (!firstChild.evaluate(null, ptr) ||
ptr.getLength() == 0)) {
return LiteralExpression.newConstant(null, PBoolean.INSTANCE,
firstChild.getDeterminism());
}
- if (children.size() == 2) {
+ if (allowShortcut && children.size() == 2) {
return ComparisonExpression.create(isNegate ? CompareOp.NOT_EQUAL
: CompareOp.EQUAL, children, ptr);
}
{code}
> Join between global index and data table if INDEX hint used
> -----------------------------------------------------------
>
> Key: PHOENIX-1560
> URL: https://issues.apache.org/jira/browse/PHOENIX-1560
> Project: Phoenix
> Issue Type: Bug
> Reporter: James Taylor
> Assignee: Maryann Xue
> Attachments: 1560.patch, 1560.v2.patch
>
>
> We already have an INDEX hint, and we already have a mechanism to collect
> referenced columns in the data table that are not in the index table (used
> only for local indexes currently). Instead of not using the global index when
> a referenced data column is not found in the index, we should rewrite the
> query to join back to the data table when the INDEX hint is present. This is
> always possible, as we always have the data PK columns in the index table,
> and our join optimization would kick in as well.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)