You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Geoffrey Jacoby (JIRA)" <ji...@apache.org> on 2019/06/06 18:38:00 UTC
[jira] [Commented] (PHOENIX-5317) Upserting rows into child views
with pk fails when the base view has an index on it.
[ https://issues.apache.org/jira/browse/PHOENIX-5317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16857986#comment-16857986 ]
Geoffrey Jacoby commented on PHOENIX-5317:
------------------------------------------
[~jisaac] - does the same thing happen if the child view is NOT tenant-owned? If not, it could be yet another symptom of PHEONIX-4657, the fact that global connections can't see tenant-owned objects.
> Upserting rows into child views with pk fails when the base view has an index on it.
> ------------------------------------------------------------------------------------
>
> Key: PHOENIX-5317
> URL: https://issues.apache.org/jira/browse/PHOENIX-5317
> Project: Phoenix
> Issue Type: Sub-task
> Affects Versions: 4.13.0, 4.14.1
> Reporter: Jacob Isaac
> Priority: Major
>
> Steps to reproduce -
> 1 Create Base Table, Base/Global View and Index using non tenanted connection.
> CREATE TABLE IF NOT EXISTS TEST.BASETABLE (
> TENANT_ID CHAR(15) NOT NULL,
> KEY_PREFIX CHAR(3) NOT NULL,
> CREATED_DATE DATE,
> CREATED_BY CHAR(15),
> SYSTEM_MODSTAMP DATE
> CONSTRAINT PK PRIMARY KEY (
> TENANT_ID,
> KEY_PREFIX
> )
> ) VERSIONS=1, MULTI_TENANT=true, IMMUTABLE_ROWS=TRUE, REPLICATION_SCOPE=1;
> CREATE VIEW IF NOT EXISTS TEST.MY_GLOBAL_VIEW (
> TEXT1 VARCHAR NOT NULL,
> INT1 BIGINT NOT NULL,
> DOUBLE1 DECIMAL(12, 3),
> IS_BOOLEAN BOOLEAN,
> RELATIONSHIP_ID CHAR(15),
> TEXT_READ_ONLY VARCHAR,
> DATE_TIME1 DATE,
> JSON1 VARCHAR,
> IP_START_ADDRESS VARCHAR
> CONSTRAINT PKVIEW PRIMARY KEY
> (
> TEXT1, INT1
> )
> )
> AS SELECT * FROM TEST.BASETABLE WHERE KEY_PREFIX = '0CY';
> CREATE INDEX IF NOT EXISTS TEST_MY_GLOBAL_VIEW_SEC_INDEX
> ON TEST.MY_GLOBAL_VIEW (TEXT1, INT1)
> INCLUDE (CREATED_BY, RELATIONSHIP_ID, JSON1, DOUBLE1, IS_BOOLEAN, IP_START_ADDRESS, CREATED_DATE, SYSTEM_MODSTAMP, TEXT_READ_ONLY);
> 2. Create child view using an tenant-owned connection
> CREATE VIEW IF NOT EXISTS TEST."z01" (COL1 VARCHAR, COL2 VARCHAR, COL3 VARCHAR, COL4 VARCHAR CONSTRAINT PK PRIMARY KEY (COL1, COL2, COL3, COL4)) AS SELECT * FROM TEST.MY_GLOBAL_VIEW;
> 3. Upsert into child view
> UPSERT INTO TEST."z01" (DATE_TIME1, INT1, TEXT1, COL1, COL2, COL3, COL4) VALUES (TO_DATE('2017-10-16 22:00:00', 'yyyy-MM-dd HH:mm:ss'), 10, 'zzzzz', '8', 'zzzzz', 'zzzzz', 'zzzzz');
> Following exception is thrown -
> 0: jdbc:phoenix:localhost> UPSERT INTO TEST."z01" (DATE_TIME1, INT1, TEXT1, COL1, COL2, COL3, COL4) VALUES (TO_DATE('2017-10-16 22:00:00', 'yyyy-MM-dd HH:mm:ss'), 10, 'zzzzz', '8', 'zzzzz', 'zzzzz', 'zzzzz');
> java.lang.IllegalArgumentException
> at com.google.common.base.Preconditions.checkArgument(Preconditions.java:76)
> at com.google.common.collect.Lists.computeArrayListCapacity(Lists.java:105)
> at com.google.common.collect.Lists.newArrayListWithExpectedSize(Lists.java:195)
> at org.apache.phoenix.index.IndexMaintainer.<init>(IndexMaintainer.java:424)
> at org.apache.phoenix.index.IndexMaintainer.create(IndexMaintainer.java:143)
> at org.apache.phoenix.schema.PTableImpl.getIndexMaintainer(PTableImpl.java:1176)
> at org.apache.phoenix.util.IndexUtil.generateIndexData(IndexUtil.java:303)
> at org.apache.phoenix.execute.MutationState$1.next(MutationState.java:519)
> at org.apache.phoenix.execute.MutationState$1.next(MutationState.java:501)
> at org.apache.phoenix.execute.MutationState.send(MutationState.java:941)
> at org.apache.phoenix.execute.MutationState.send(MutationState.java:1387)
> at org.apache.phoenix.execute.MutationState.commit(MutationState.java:1228)
> at org.apache.phoenix.jdbc.PhoenixConnection$3.call(PhoenixConnection.java:666)
> at org.apache.phoenix.jdbc.PhoenixConnection$3.call(PhoenixConnection.java:662)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at org.apache.phoenix.jdbc.PhoenixConnection.commit(PhoenixConnection.java:662)
> at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:399)
> at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:379)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:378)
> at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:366)
> at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1775)
> at sqlline.Commands.execute(Commands.java:822)
> at sqlline.Commands.sql(Commands.java:732)
> at sqlline.SqlLine.dispatch(SqlLine.java:807)
> at sqlline.SqlLine.begin(SqlLine.java:681)
> at sqlline.SqlLine.start(SqlLine.java:398)
> at sqlline.SqlLine.main(SqlLine.java:292)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)