You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/02/12 10:45:54 UTC

[GitHub] [calcite] danny0405 commented on a change in pull request #1790: [CALCITE-3769] Deprecate TableScanRule

danny0405 commented on a change in pull request #1790: [CALCITE-3769] Deprecate TableScanRule
URL: https://github.com/apache/calcite/pull/1790#discussion_r378172547
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/tools/RelRunners.java
 ##########
 @@ -29,6 +35,19 @@ private RelRunners() {}
 
   /** Runs a relational expression by creating a JDBC connection. */
   public static PreparedStatement run(RelNode rel) {
+    final RelShuttle shuttle = new RelHomogeneousShuttle() {
+      @Override public RelNode visit(TableScan scan) {
+        final RelOptTable table = scan.getTable();
+        if (scan instanceof LogicalTableScan
+            && Bindables.BindableTableScan.canHandle(table)) {
+          // Always replace the LogicalTableScan with BindableTableScan
+          // because it's implementation does not require a "schema" as context.
+          return Bindables.BindableTableScan.create(scan.getCluster(), table);
 
 Review comment:
   Because the Enumerables implementation needs a "schema" to look up for the table. but the RelRunners does not actually have a schema, the Bindables actually can implement that.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services