Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-14085

schema changes after using "create view" command via flink-table-sql-client

    XMLWordPrintableJSON

Details

    • Important

    Description

      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>>, in which the schema of the "data" field becomes the same as the "data" field in the table "abc12".

       

      In summary, we found that the schema of the second table will 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, the orignal schema of the row type field in the second table will be replaced 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 indicates that the schema of the table still changes.   

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            Morning999 Junling
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: