mdayakar commented on code in PR #6093:
URL: https://github.com/apache/hive/pull/6093#discussion_r2401151805


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/CreateViewAnalyzer.java:
##########
@@ -113,6 +113,12 @@ private String getExpandedText(List<FieldSchema> 
imposedSchema, ASTNode select,
     String expandedText = 
ctx.getTokenRewriteStream().toString(select.getTokenStartIndex(), 
select.getTokenStopIndex());
 
     if (imposedSchema != null) {

Review Comment:
   Here issue comes when only column names are specified for the view otherwise 
there will not be any issue. 
   For example below create view query
   `create view vw_z as (
       (  (select a, b from tbl_x ) )
       );`
   the expanded test is converted as `
       (  (select a, b from tbl_x ) )
       )` and compiling this statement doesn't create any issue.
       
    But for the below query
       `create view vw_y (col_b) as (
       ( ( select b from tbl_x ) )
       );`
       the expanded text is converted as `SELECT b AS col_b FROM (
       ( ( select b from tbl_x ) )
       ) vw_y` this results into compilation issue.
       
      So here handled only the case when issue is coming, other scenarios will 
work as previous. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to