rdblue commented on code in PR #5872:
URL: https://github.com/apache/iceberg/pull/5872#discussion_r990819694
##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java:
##########
@@ -145,6 +158,83 @@ public Filter[] pushedFilters() {
return pushedFilters;
}
+ @Override
+ public boolean pushAggregation(Aggregation aggregation) {
+ if (!(table instanceof BaseTable)) {
+ return false;
+ }
+ boolean aggregatePushdown =
+ Boolean.parseBoolean(
+ table
+ .properties()
+ .getOrDefault(AGGREGATE_PUSHDOWN_ENABLED,
AGGREGATE_PUSHDOWN_ENABLED_DEFAULT));
+ if (!aggregatePushdown) {
+ return false;
+ }
+
+ Snapshot currentSnapshot = table.currentSnapshot();
+ if (currentSnapshot != null) {
+ Map<String, String> map = currentSnapshot.summary();
+ // if there are row-level deletes in current snapshot, the statics
+ // maybe changed, so disable push down aggregate
+ if (Integer.parseInt(map.get("total-position-deletes")) > 0
+ || Integer.parseInt(map.get("total-equality-deletes")) > 0) {
Review Comment:
Can you use `getOrDefault` to handle cases where the key isn't present?
--
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]