chunweilei commented on a change in pull request #1102: [CALCITE-1515]
RelBuilder supports creating TableFunctionScan
URL: https://github.com/apache/calcite/pull/1102#discussion_r265423932
##########
File path: core/src/test/java/org/apache/calcite/test/RelBuilderTest.java
##########
@@ -298,6 +298,23 @@
assertThat(root, hasTree(expected));
}
+ @Test public void testTableFunctionScan() {
+ // Equivalent SQL:
+ // SELECT *
+ // FROM TABLE(DEDUP(CURSOR(select * from emp), CURSOR(select * from
DEPT), 'NAME'))
+ final RelBuilder builder = RelBuilder.create(config().build());
+ RelNode root = builder.scan("EMP").scan("DEPT")
+ .functionScan(new MockSqlOperatorTable.DedupFunction(),
+ Lists.newArrayList(builder.cursor(0),
+ builder.cursor(1))).build();
+ final String expected = "LogicalTableFunctionScan(invocation="
+ + "[DEDUP(CURSOR($0), CURSOR($1))], "
+ + "rowType=[RecordType(VARCHAR(1024) NAME)])\n"
+ + " LogicalTableScan(table=[[scott, EMP]])\n"
+ + " LogicalTableScan(table=[[scott, DEPT]])\n";
+ assertThat(root, hasTree(expected));
+ }
Review comment:
Got it. Will do.
----------------------------------------------------------------
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