jinxing64 commented on a change in pull request #1355: [CALCITE-3228] Error 
while applying rule ProjectScanRule: interpreter
URL: https://github.com/apache/calcite/pull/1355#discussion_r310612842
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/rel/rules/ProjectTableScanRule.java
 ##########
 @@ -103,12 +103,12 @@ protected static boolean test(TableScan scan) {
   protected void apply(RelOptRuleCall call, Project project, TableScan scan) {
     final RelOptTable table = scan.getTable();
     assert table.unwrap(ProjectableFilterableTable.class) != null;
-
-    final Mappings.TargetMapping mapping = project.getMapping();
-    if (mapping == null
-        || Mappings.isIdentity(mapping)) {
+    if (!project.isMapping()) {
       return;
     }
+    final Mappings.TargetMapping mapping = Project.getPartialMapping(
+            project.getInput().getRowType().getFieldCount(),
+            project.getProjects());
 
 Review comment:
   Shall we consider update 
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/interpreter/Bindables.java#L250
 ?
   
   If not, it might be only safe to pass an identity mapping to 
`BindableTableScan.create`. Because in my understanding, current 
`BindableTableScan` doesn't have functionality for filterable and projectable 
scan.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to