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

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_r775158618



##########
File path: 
contrib/format-iceberg/src/main/java/org/apache/drill/exec/store/iceberg/plan/IcebergPluginImplementor.java
##########
@@ -144,7 +155,23 @@ public boolean splitProject(Project project) {
 
   @Override
   public boolean canImplement(Project project) {
-    return true;
+    RelTraitSet traitSet = project.getInput().getTraitSet();
+    if (!traitSet.isEmpty()) {
+      RelTrait trait = traitSet.get(0);
+      if (trait instanceof Convention) {
+        Convention c = (Convention) trait;
+        if (StringUtils.contains(c.getName(), 
IcebergFormatPlugin.ICEBERG_CONVENTION_PREFIX)) {
+          return true; // accept the iceberg queries
+        }
+      }
+    }
+    List<String> fields = project.getInput().getRowType().getFieldNames();
+    if (!fields.isEmpty()) {
+      if(StringUtils.equals(SchemaPath.DYNAMIC_STAR, fields.get(0))) {
+        return true; // accept the plan queries of iceberg
+      }
+    }
+    return false; // does not affect other format and storage

Review comment:
       I don't think that we should rely on the convention of input rel node. 
It could have any convention, but the rule will be responsible for the 
conversion of input. Please see this line as an example: 
https://github.com/apache/drill/blob/ec76ad05680612b84147993d66312f040430cac0/exec/java-exec/src/main/java/org/apache/drill/exec/store/plan/rule/PluginProjectRule.java#L56.
 If no conversion of input happened, the planner will accept another plan where 
all children were converted.




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


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

Reply via email to