phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chinmay Kulkarni (Jira)" <j...@apache.org>
Subject [jira] [Created] (PHOENIX-6033) Unable to add back a parent column that was earlier dropped from a view
Date Tue, 21 Jul 2020 00:24:00 GMT
Chinmay Kulkarni created PHOENIX-6033:
-----------------------------------------

             Summary: Unable to add back a parent column that was earlier dropped from a view
                 Key: PHOENIX-6033
                 URL: https://issues.apache.org/jira/browse/PHOENIX-6033
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.15.0, 5.0.0
            Reporter: Chinmay Kulkarni
             Fix For: 5.1.0, 4.16.0


In 4.14.3, we allowed adding a column (with the same name as a column inherited from the parent)
back to a view, which was dropped in the past. In 4.x this is no longer allowed.

Start 4.x server and run the following with a 4.x client:
{code:sql}
CREATE TABLE IF NOT EXISTS T (A INTEGER PRIMARY KEY, B INTEGER, C VARCHAR, D INTEGER);
-- create view
CREATE VIEW IF NOT EXISTS V (VA INTEGER, VB INTEGER) AS SELECT * FROM T WHERE B=200;
UPSERT INTO V(A,B,C,D,VA,VB) VALUES (2, 200, 'def', -20, 91, 101);
ALTER VIEW V DROP COLUMN C;

SELECT * FROM V;
+----+------+------+-----+------+
| A  |  B   |  D   | VA  |  VB  |
+----+------+------+-----+------+
| 2  | 200  | -20  | 91  | 101  |
+----+------+------+-----+------+

ALTER VIEW C ADD C VARCHAR;
-- The above add column step throws an error. It used to work before 4.15.
{code}

The stack trace for the error thrown is:
{code:java}
Error: ERROR 1012 (42M03): Table undefined. tableName=C (state=42M03,code=1012)
org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table undefined. tableName=C
	at org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:777)
	at org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:442)
	at org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:434)
	at org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:425)
	at org.apache.phoenix.compile.FromCompiler.getResolver(FromCompiler.java:277)
	at org.apache.phoenix.schema.MetaDataClient.addColumn(MetaDataClient.java:3627)
	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableAddColumnStatement$1.execute(PhoenixStatement.java:1488)
	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:415)
	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:397)
	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:396)
	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:384)
	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1886)
	at sqlline.Commands.execute(Commands.java:814)
	at sqlline.Commands.sql(Commands.java:754)
	at sqlline.SqlLine.dispatch(SqlLine.java:646)
	at sqlline.SqlLine.begin(SqlLine.java:510)
	at sqlline.SqlLine.start(SqlLine.java:233)
	at sqlline.SqlLine.main(SqlLine.java:175)
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message