ggangadharan commented on code in PR #6990:
URL: https://github.com/apache/hive/pull/6990#discussion_r4740112239


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/DeleteSemanticAnalyzer.java:
##########
@@ -159,6 +162,18 @@ private SearchArgument convertFilterExpressionInTS(Table 
table, BaseSemanticAnal
     return result.getSearchArgument();
   }
 
+  /**
+   * Whether Hive filters the scan on a virtual column. A storage handler 
cannot evaluate a virtual column, so the
+   * filter pushed to it leaves out the conjuncts that read one: deleting the 
files that filter matches would also
+   * delete the rows those conjuncts exclude.
+   */
+  private static boolean filtersOnVirtualColumn(TableScanOperator tableScan) {

Review Comment:
   Done:
   
       .map(op -> ((FilterOperator) op).getConf().getPredicate())
       .anyMatch(VirtualColumn::readsVirtualColumn);
   
   This also covers `SNAPSHOT__ID` for the metadata-delete check. On the 
previous revision, `delete from ice_vc_del where a = 1 and snapshot__id = 0` 
failed at compile time in `HiveIcebergStorageHandler.canPerformMetadataDelete` 
(`StrictMetricsEvaluator` -> `ValidationException: Cannot find field 
'SNAPSHOT__ID'`). Now it is not treated as a metadata delete and deletes 
nothing.



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