[ https://issues.apache.org/jira/browse/PHOENIX-3371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Taylor updated PHOENIX-3371: ---------------------------------- Attachment: PHOENIX-3371_v2.patch Added more delete tests and cleaned up test a bit. Still not able to repro. Will close as Not Reproducible if I don't hear back by the end of the week. > 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 > Attachments: PHOENIX-3371.patch, PHOENIX-3371_v2.patch > > > 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)