soumyakanti3578 commented on code in PR #6103:
URL: https://github.com/apache/hive/pull/6103#discussion_r2467770051


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelFieldTrimmer.java:
##########
@@ -203,6 +206,26 @@ protected RexNode handle(RexFieldAccess fieldAccess) {
     return dispatchTrimFields(input, fieldsUsedBuilder.build(), extraFields);
   }
 
+  private static void setColumnAccessInfoForViews(RelNode rel, ImmutableBitSet 
fieldsUsed) {
+    final ColumnAccessInfo columnAccessInfo = COLUMN_ACCESS_INFO.get();
+    final Map<RelNode, Pair<Table, List<RexNode>>> relNodeToTableAndProjects = 
VIEW_RELNODE_TO_TABLE_AND_PROJECTS.get();
+
+    // HiveTableScans are handled separately in HiveTableScan's trimFields 
method.
+    if (!(rel instanceof HiveTableScan) &&
+        columnAccessInfo != null &&
+        relNodeToTableAndProjects != null &&
+        relNodeToTableAndProjects.containsKey(rel)) {
+      Table table = 
Objects.requireNonNull(relNodeToTableAndProjects.get(rel).left);
+      List<RexNode> projects = relNodeToTableAndProjects.get(rel).right;
+      List<FieldSchema> tableAllCols = table.getAllCols();
+      for (Ord<RexNode> ord : Ord.zip(projects)) {
+        if (fieldsUsed.get(ord.i)) {
+          columnAccessInfo.add(table.getCompleteName(), 
tableAllCols.get(ord.i).getName());
+        }
+      }

Review Comment:
   Thanks for the suggestion! I have simplified this in the latest version.



-- 
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