You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/12/01 16:04:00 UTC

[jira] [Commented] (DRILL-8060) Avoid the NPE in the Filter of Iceberg Implementor

    [ https://issues.apache.org/jira/browse/DRILL-8060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17451905#comment-17451905 ] 

ASF GitHub Bot commented on DRILL-8060:
---------------------------------------

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


> Avoid the NPE in the Filter of Iceberg Implementor
> --------------------------------------------------
>
>                 Key: DRILL-8060
>                 URL: https://issues.apache.org/jira/browse/DRILL-8060
>             Project: Apache Drill
>          Issue Type: Improvement
>            Reporter: Cong Luo
>            Assignee: Cong Luo
>            Priority: Major
>             Fix For: 1.20.0
>
>
> Query the phoenix data using the filter got the NPE (stack error at the Iceberg format module), because the _#canImplement(Filter filter)_ might accept a _*JDBCTableScan*_ (or an object that extend the _*TableScan*_ of Calcite), then _#getDrillTable(TableScan)_ will get the null.
> {code:java}
> Caused by: java.lang.NullPointerException: null
>         at org.apache.drill.exec.store.iceberg.plan.IcebergPluginImplementor.canImplement(IcebergPluginImplementor.java:102)
>         at org.apache.drill.exec.store.plan.rule.PluginConverterRule.matches(PluginConverterRule.java:64)
>         at org.apache.calcite.plan.volcano.VolcanoRuleCall.matchRecurse(VolcanoRuleCall.java:263)
>         at org.apache.calcite.plan.volcano.VolcanoRuleCall.match(VolcanoRuleCall.java:247)
>         at org.apache.calcite.plan.volcano.VolcanoPlanner.fireRules(VolcanoPlanner.java:1566)
>         at org.apache.calcite.plan.volcano.VolcanoPlanner.registerImpl(VolcanoPlanner.java:1840)
>         at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:848)
>         at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:864)
>         at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:92)
>         at org.apache.calcite.rel.AbstractRelNode.onRegister(AbstractRelNode.java:329)
>         at org.apache.calcite.plan.volcano.VolcanoPlanner.registerImpl(VolcanoPlanner.java:1701)
>         at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:848)
>         at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:864)
>         at org.apache.calcite.plan.volcano.VolcanoPlanner.changeTraits(VolcanoPlanner.java:531)
>         at org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:324)
>         at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform(DefaultSqlHandler.java:405)
>         at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform(DefaultSqlHandler.java:351)
>         at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRawDrel(DefaultSqlHandler.java:245)
>         at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToDrel(DefaultSqlHandler.java:308)
>         at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:173)
>         at org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan(DrillSqlWorker.java:283)
>         at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPhysicalPlan(DrillSqlWorker.java:163)
>         at org.apache.drill.exec.planner.sql.DrillSqlWorker.convertPlan(DrillSqlWorker.java:128)
>         at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:93)
>         at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:593)
>         at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:274)
>         ... 3 common frames omitted {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)