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]


Reply via email to