You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by pengcheng xiong <px...@hortonworks.com> on 2015/09/15 01:05:31 UTC

Review Request 38383: Correct the column/table names in subquery expression when creating a view

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38383/
-----------------------------------------------------------

Review request for hive and John Pullokkaran.


Repository: hive-git


Description
-------

Right now Hive does not quote column/table names in subquery expression when create a view. For example
{code}
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
{code}


Diffs
-----

  ql/src/java/org/apache/hadoop/hive/ql/parse/QBSubQuery.java 92cbabc 
  ql/src/java/org/apache/hadoop/hive/ql/parse/SubQueryUtils.java 87a7ced 
  ql/src/test/queries/clientpositive/subquery_views.q f15d41b 
  ql/src/test/results/clientpositive/subquery_views.q.out c59d86e 

Diff: https://reviews.apache.org/r/38383/diff/


Testing
-------


Thanks,

pengcheng xiong


Re: Review Request 38383: Correct the column/table names in subquery expression when creating a view

Posted by pengcheng xiong <px...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38383/
-----------------------------------------------------------

(Updated Sept. 15, 2015, 11:45 p.m.)


Review request for hive and John Pullokkaran.


Repository: hive-git


Description
-------

Right now Hive does not quote column/table names in subquery expression when create a view. For example
{code}
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
{code}


Diffs (updated)
-----

  ql/src/java/org/apache/hadoop/hive/ql/parse/QBSubQuery.java 92cbabc 
  ql/src/java/org/apache/hadoop/hive/ql/parse/SubQueryUtils.java 87a7ced 
  ql/src/test/queries/clientpositive/subquery_views.q f15d41b 
  ql/src/test/results/clientnegative/subquery_exists_implicit_gby.q.out 4830c00 
  ql/src/test/results/clientnegative/subquery_nested_subquery.q.out ae3bc8f 
  ql/src/test/results/clientnegative/subquery_notexists_implicit_gby.q.out 74422af 
  ql/src/test/results/clientnegative/subquery_windowing_corr.q.out 647a535 
  ql/src/test/results/clientpositive/subquery_views.q.out c59d86e 

Diff: https://reviews.apache.org/r/38383/diff/


Testing
-------


Thanks,

pengcheng xiong