danny0405 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_r311372854
 
 

 ##########
 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:
   Just as the doc says:
   > Planner rule that converts a {@link Project}
       on a {@link org.apache.calcite.rel.core.TableScan}
       of a {@link org.apache.calcite.schema.ProjectableFilterableTable}
       to a {@link org.apache.calcite.interpreter.Bindables.BindableTableScan}.
   
   If the BindableTableScan does not support project expressions push down, we 
should fix it firstly.

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