phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jiping Zhou (JIRA)" <j...@apache.org>
Subject [jira] [Created] (PHOENIX-3371) Aggregate Function is broken if secondary index exists
Date Wed, 12 Oct 2016 01:18:20 GMT
Jiping Zhou created PHOENIX-3371:
------------------------------------

             Summary: Aggregate Function is broken if secondary index exists
                 Key: PHOENIX-3371
                 URL: https://issues.apache.org/jira/browse/PHOENIX-3371
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.8.1
            Reporter: Jiping Zhou


1. Create a global table 
CREATE TABLE IF NOT EXISTS PLATFORM_ENTITY.GLOBAL_TABLE (
ORGANIZATION_ID CHAR(15) NOT NULL, 
KEY_PREFIX CHAR(3) NOT NULL,
CREATED_DATE DATE,
CREATED_BY CHAR(15),
CONSTRAINT PK PRIMARY KEY (
ORGANIZATION_ID, 
KEY_PREFIX
)
) VERSIONS=1, IMMUTABLE_ROWS=true, MULTI_TENANT=true;
2. Create a global view on base global table with where clause
CREATE VIEW IF NOT EXISTS PLATFORM_ENTITY.GLOBAL_VIEW (
INT1 BIGINT NOT NULL,
DOUBLE1 DECIMAL(12, 3),
IS_BOOLEAN BOOLEAN,
TEXT1 VARCHAR,
CONSTRAINT PKVIEW PRIMARY KEY
(
INT1
)
)
AS SELECT * FROM PLATFORM_ENTITY.GLOBAL_TABLE WHERE KEY_PREFIX = '123';
3. Create gloabl index on the global view
CREATE INDEX IF NOT EXISTS GLOBAL_INDEX
ON PLATFORM_ENTITY.GLOBAL_VIEW (TEXT1 DESC, INT1)
INCLUDE (CREATED_BY, DOUBLE1, IS_BOOLEAN, CREATED_DATE);
4. Create tenant specific view on top of global view
CREATE VIEW IF NOT EXISTS PLATFORM_ENTITY.TENANT_VIEW 
AS SELECT * FROM PLATFORM_ENTITY.GLOBAL_VIEW;
5. Insert 10 record in tenant view
6. Remove any record in tenant view
7. Query in tenant view
SELECT * FROM PLATFORM_ENTITY.TENANT_VIEW;
9 records are returned
SELECT COUNT(*) FROM PLATFORM_ENTITY.TENANT_VIEW;
10 was returned.

I guess the issue was secondary index is not updated when delete or update happens. And the
aggregate function is using the secondary index. The problem does not happen in 4.8.0-1.0.4

It is a regression



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message