You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2021/12/01 16:03:46 UTC

[GitHub] [drill] vvysotskyi commented on a change in pull request #2389: DRILL-8060: Avoid the NPE in the Filter of Iceberg Implementor

vvysotskyi commented on a change in pull request #2389:
URL: https://github.com/apache/drill/pull/2389#discussion_r760330747



##########
File path: contrib/format-iceberg/src/main/java/org/apache/drill/exec/store/iceberg/plan/IcebergPluginImplementor.java
##########
@@ -97,8 +98,13 @@ public boolean canImplement(Filter filter) {
 
     if (expression != null) {
       try {
-        TableScan tableScan = DrillRelOptUtil.findScan(filter.accept(SubsetRemover.INSTANCE));
-        DrillTable drillTable = DrillRelOptUtil.getDrillTable(tableScan);
+        TableScan tableScan;
+        DrillTable drillTable;
+        if (!Optional.ofNullable(tableScan = DrillRelOptUtil
+             .findScan(filter.accept(SubsetRemover.INSTANCE))).isPresent()
+            || !Optional.ofNullable(drillTable = DrillRelOptUtil.getDrillTable(tableScan)).isPresent()) {
+         return false;
+        }
         GroupScan scan = drillTable.getGroupScan();

Review comment:
       I meant something like this...
   ```suggestion
           CheckedFunction<DrillTable, GroupScan, IOException> groupScanFunction = DrillTable::getGroupScan;
           GroupScan scan = Optional.ofNullable(tableScan)
             .map(DrillRelOptUtil::getDrillTable)
             .map(groupScanFunction)
             .orElse(null);
   ```




-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org