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

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

    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

            People

              jvs John Sichi
              jvs John Sichi
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: