Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-1067

CREATE VIEW followup: impose casts on view result columns if underlying column types change

Log workAgile BoardRank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsAdd voteVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.6.0
    • None
    • Query Processor
    • None

    Description

      Consider

      CREATE TABLE t(i INT);
      CREATE VIEW v AS SELECT i FROM t;
      ALTER TABLE t REPLACE COLUMNS (i STRING);
      SELECT i FROM v;

      What will be the result type for i in the final SELECT?

      Consensus at code review was that it should be INT (not STRING) since the CREATE VIEW is supposed to freeze the metadata for the view's result schema. Note that SQL:2008 ALTER COLUMN SET DATA TYPE doesn't cover this case, because it doesn't support changing the datatype family. For this case, MySQL produces VARCHAR rather than INT, and (consistently) DESCRIBE v and INFORMATION_SCHEMA show VARCHAR as well, so either they are propagating the type change in the catalog, or dynamically re-deriving it.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jvs John Sichi Assign to me
            jvs John Sichi

            Dates

              Created:
              Updated:

              Slack

                Issue deployment