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/11/07 18:43:38 UTC

[GitHub] [calcite] hsyuan commented on a change in pull request #1565: [CALCITE-3481] Support convert TableFunctionScan to SqlNode

hsyuan commented on a change in pull request #1565: [CALCITE-3481] Support convert TableFunctionScan to SqlNode
URL: https://github.com/apache/calcite/pull/1565#discussion_r343810844
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java
 ##########
 @@ -828,6 +830,27 @@ public Result visit(Uncollect e) {
     return result(asNode, ImmutableList.of(Clause.FROM), e, null);
   }
 
+  public Result visit(TableFunctionScan e) {
+    final List<SqlNode> inputSqlNodes = new ArrayList<>();
+    for (int i = 0; i < e.getInputs().size(); i++) {
+      Result child = visitChild(i, e.getInput(i));
+      inputSqlNodes.add(child.asStatement());
+    }
+    final Context context = tableFunctionScanContext(inputSqlNodes);
+    SqlNode callNode = context.toSql(null, e.getCall());
+    // Convert to table function call, "TABLE($function_name(xxx))"
+    SqlNode tableCall = new SqlBasicCall(
+        SqlStdOperatorTable.COLLECTION_TABLE,
+        new SqlNode[]{callNode},
+        SqlParserPos.ZERO);
+    SqlNode select = new SqlSelect(
+        SqlParserPos.ZERO, null, null, tableCall,
+        null, null, null, null, null, null, null);
+    Result x = new  Result(select,
 
 Review comment:
   additional space after new

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