soumyakanti3578 commented on code in PR #6103:
URL: https://github.com/apache/hive/pull/6103#discussion_r2418885125
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java:
##########
@@ -4918,15 +4919,12 @@ private RelNode genLogicalPlan(QB qb, boolean
outerMostQB,
aliasToRel.put(subqAlias, relNode);
if (qb.getViewToTabSchema().containsKey(subqAlias)) {
- if (relNode instanceof HiveProject) {
- if (this.viewProjectToTableSchema == null) {
- this.viewProjectToTableSchema = new LinkedHashMap<>();
- }
- viewProjectToTableSchema.put((HiveProject) relNode,
qb.getViewToTabSchema().get(subqAlias));
- } else {
- throw new SemanticException("View " + subqAlias + " is
corresponding to "
- + relNode.toString() + ", rather than a HiveProject.");
+ HiveProject project = extractFirstProject(relNode)
Review Comment:
We use the projects for authorization in `HiveRelFieldTrimmer.trimFields`
[here](https://github.com/apache/hive/blob/4f7140f0b324b5f2abde10acb671fd1f2ced9517/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelFieldTrimmer.java#L740),
and that's the only place where we use it. I believe that is why we need only
the first project, that gives us the final list of fields.
I don't think we can use other projects in place of the top one, as the
fields could be different.
I am not really sure if we officially support views with limits or order by,
but right now it looks like we can support them.
--
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]