You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "mdayakar (via GitHub)" <gi...@apache.org> on 2025/10/03 08:10:56 UTC

Re: [PR] HIVE-26493: Hive throws error when querying a view that was created successfully [hive]

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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org