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

Thomas D'Silva commented on PHOENIX-4195:
-----------------------------------------

[~gjacoby] Thanks for picking this up. I think its caused the following code in 
DeleteCompiler which sets noQueryReqd if the scan is a point lookup. It thinks 
its a point lookup because the where clause includes all the pk columns of the 
base table, but since this is a multi-tenant table that has views that have 
added their own pk columns its not really deleting a single row. 

I don't think we can determine its a point lookup if the table is multi-tenant 
(since child views could have added their own pk column).

{code}
// We need to have all indexed columns available in all immutable indexes in 
order
        // to generate the delete markers from the query. We also cannot have 
any filters
        // except for our SkipScanFilter for point lookups.
        // A simple check of the non existence of a where clause in the parse 
node is not sufficient, as the where clause
        // may have been optimized out. Instead, we check that there's a single 
SkipScanFilter
        // If we can generate a plan for every index, that means all the 
required columns are available in every index,
        // hence we can drive the delete from any of the plans.
        noQueryReqd &= queryPlans.size() == 1 + clientSideIndexes.size();
        int queryPlanIndex = 0;
        while (noQueryReqd && queryPlanIndex < queryPlans.size()) {
            QueryPlan plan = queryPlans.get(queryPlanIndex++);
            StatementContext context = plan.getContext();
            noQueryReqd &= (!context.getScan().hasFilter()
                    || context.getScan().getFilter() instanceof SkipScanFilter)
                && context.getScanRanges().isPointLookup();
        }
{code}

 

 

> PHOENIX-4195 Deleting tenant rows using a tenant or global connection on the 
> base table fails
> ---------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-4195
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4195
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Thomas D'Silva
>            Assignee: Geoffrey Jacoby
>            Priority: Major
>         Attachments: test.diff
>
>
> The attached test fails.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to