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:
[email protected]
With regards,
Apache Git Services