soumyakanti3578 commented on code in PR #5196:
URL: https://github.com/apache/hive/pull/5196#discussion_r1939964029
##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/views/HivePushdownSnapshotFilterRule.java:
##########
@@ -80,7 +82,12 @@ private HivePushdownSnapshotFilterRule(Config config) {
@Override
public void onMatch(RelOptRuleCall call) {
HiveFilter filter = call.rel(0);
- RexNode newCondition = filter.getCondition().accept(new
SnapshotIdShuttle(call.builder().getRexBuilder(), call.getMetadataQuery(),
filter));
+ RexNode expandedCondition = RexUtil.expandSearch(
+ filter.getCluster().getRexBuilder(), null, filter.getCondition()
+ );
Review Comment:
I added this because of the following failure:
```
[ERROR] Failures:
[ERROR]
TestMaterializedViewRebuild.testSecondRebuildCanBeIncrementalAfterMajorCompaction:127
cannot convert SARG literal to class java.lang.Long
```
This CBO plan for which this fails is:
```
HiveProject(a=[$0], b=[$1], c=[$2])
HiveFilter(condition=[SEARCH($0, Sarg[(0..+∞); NULL AS TRUE])])
HiveTableScan(table=[[default, t1]], table:alias=[t1])
```
The plan is generated while running the query:
https://github.com/apache/hive/blob/84cdf6003678ed673d59d223ef7f4dac1aa6fdc0/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestMaterializedViewRebuild.java#L127
The root cause of the issue is that we are trying to get a `Sarg` value as
`Long` here:
https://github.com/apache/hive/blob/84cdf6003678ed673d59d223ef7f4dac1aa6fdc0/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/views/HivePushdownSnapshotFilterRule.java#L120
Let me know if the diff is fine or if we should add an `if` check for `Sarg`
and extract the snapshotId from it.
--
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]