Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-11699 Support special characters in quoted table names
  3. HIVE-11815

Correct the column/table names in subquery expression when creating a view

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0, 1.0.1, 1.2.0, 1.2.1
    • 2.0.0
    • None
    • None

    Description

      Right now Hive does not quote column/table names in subquery expression when create a view. For example

      hive>
          > create table tc (`@d` int);
      OK
      Time taken: 0.119 seconds
      hive> create view tcv as select * from tc b where exists (select a.`@d` from tc a where b.`@d`=a.`@d`);
      OK
      Time taken: 0.075 seconds
      hive> describe extended tcv;
      OK
      @d                  	int
      
      Detailed Table Information	Table(tableName:tcv, dbName:default, owner:pxiong, createTime:1442250005, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:@d, type:int, comment:null)], location:null, inputFormat:org.apache.hadoop.mapred.SequenceFileInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:null, parameters:{}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), partitionKeys:[], parameters:{transient_lastDdlTime=1442250005}, viewOriginalText:select * from tc b where exists (select a.@d from tc a where b.@d=a.@d), viewExpandedText:select `b`.`@d` from `default`.`tc` `b` where exists (select a.@d from tc a where b.@d=a.@d), tableType:VIRTUAL_VIEW)
      Time taken: 0.063 seconds, Fetched: 3 row(s)
      hive> select * from tcv;
      FAILED: SemanticException line 1:63 character '@' not supported here
      line 1:84 character '@' not supported here
      line 1:89 character '@' not supported here in definition of VIEW tcv [
      select `b`.`@d` from `default`.`tc` `b` where exists (select a.@d from tc a where b.@d=a.@d)
      ] used as tcv at Line 1:14
      

      Attachments

        1. HIVE-11815.01.patch
          9 kB
          Pengcheng Xiong
        2. HIVE-11815.02.patch
          13 kB
          Pengcheng Xiong
        3. HIVE-11815.03.patch
          13 kB
          Pengcheng Xiong

        Issue Links

          Activity

            People

              pxiong Pengcheng Xiong
              pxiong Pengcheng Xiong
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: