Junling created FLINK-14085:
-------------------------------
Summary: schema changes after using "create view" command via
flink-table-sql-client
Key: FLINK-14085
URL: https://issues.apache.org/jira/browse/FLINK-14085
Project: Flink
Issue Type: Bug
Components: Table SQL / Client, Table SQL / Planner
Affects Versions: 1.9.0, 1.8.0, 1.7.2
Environment: Centos 7.0 / JAVA 1.8
Reporter: Junling
Assume there are two tables in the running environment of the flink sql client.
One is abc12, the schema is ROW<taskId VARCHAR, sourceId VARCHAR,data ROW<id
VARCHR,value1 VARCHAR>>
The other is abc13, the schema is ROW<taskId VARCHAR, sourceId VARCHAR,data
ROW<id VARCHR,value2 VARCHAR>>
If we execute the "create view" command such as " create view myview as select
data from abc12", then the bug will happen. The schema of the table abc13
will change as ROW<taskId VARCHAR, sourceId VARCHAR,data ROW<id VARCHR,value1
VARCHAR>>
We found that the schema of the second table will be change after running
"create view" command on the first table if these two tables have the row type
field with the same structure. Here the same structure means that the field
type of the row field is same, and the field name can be different. e.g.
data ROW<a VARCHAR,b VARCHAR> and data1 ROW<c VARCHAR,d VARCHAR> has the same
structure. As the affect of the row type field with the same structure, it
will replace the orignal schema of the row type field in the second table by
the schema of the row type field in the first table.
This bug exits in the flink 1.7, 1.8 and 1.9. In the 1.7 version, we can use
the "describe" command to see the changed schema. In the 1.9 version, since the
catalogManager is introduced, it looks good when using the "describe" command.
However, when using "select" command to select the filed name in the row type
filed, it will rise up an exception that says the column not exists in the
table, which means the schema of the table still changes.
--
This message was sent by Atlassian Jira
(v8.3.2#803003)