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

CREATE VIEW followup: add support for column-aliasing on subselect and use it when storing view definition with column renaming

    XMLWordPrintableJSON

Details

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

    Description

      Copied from the original comment:

      If you do CREATE VIEW v(x,y) AS SELECT a+1,b+2 FROM t

      then we'll store the expanded view def as SELECT `_c0` AS `x`,`_c1` AS `y` FROM (SELECT `t`.`a`+1,`t`.`b`+2 FROM `t`) `v`

      As a result, if hive ever changes its convention for generating anonymous expression names (_c0, _c1, ...), such stored view definitions will break.

      The only way I can think of to avoid this is to implement SQL:200n's column-alias-by-position construct , e.g.

      (SELECT `t`.`a`+1,`t`.`b`+2 FROM `t`) AS `v`(`x`,`y`)

      (similar to what was done for LATERAL VIEW).

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated: