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 2019/10/28 10:52:51 UTC

[GitHub] [calcite] danny0405 commented on a change in pull request #1541: [CALCITE-3449] sync tableName logic from TableScan into TableModify

danny0405 commented on a change in pull request #1541: [CALCITE-3449] sync tableName logic from TableScan into TableModify
URL: https://github.com/apache/calcite/pull/1541#discussion_r339501900
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java
 ##########
 @@ -652,14 +643,28 @@ public boolean hasTrickyRollup(Sort e, Aggregate aggregate) {
             fc.getFieldIndex() < aggregate.getGroupSet().cardinality());
   }
 
+  private SqlIdentifier getSqlTargetTable(RelNode e) {
+    final SqlIdentifier sqlTargetTable;
+    final JdbcTable jdbcTable = e.getTable().unwrap(JdbcTable.class);
+    if (jdbcTable != null) {
+      // Use the foreign catalog, schema and table names, if they exist,
+      // rather than the qualified name of the shadow table in Calcite.
+      sqlTargetTable = jdbcTable.tableName();
+    } else {
+      final List<String> qualifiedName = e.getTable().getQualifiedName();
+      sqlTargetTable = new SqlIdentifier(qualifiedName, SqlParserPos.ZERO);
+    }
+
+    return sqlTargetTable;
 
 Review comment:
   Thanks, the code looks good, can you add a test case in `RelToSqlConverterTest` ?

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