Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,7 @@ public Result visit(TableFunctionScan e) {
SqlNode select = new SqlSelect(
SqlParserPos.ZERO, null, null, tableCall,
null, null, null, null, null, null, null, SqlNodeList.EMPTY);
Result x = new Result(select,
ImmutableList.of(Clause.SELECT), null, e.getRowType(), null);
return x;
return result(select, ImmutableList.of(Clause.SELECT), e, null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3734,6 +3734,19 @@ private void checkLiteral2(String expression, String expected) {
sql(sql).ok(expected);
}

/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-3651">[CALCITE-3651]
* NullPointerException when convert relational algebra that correlates TableFunctionScan</a>. */
@Test public void testLateralCorrelate() {
final String query = "select * from \"product\",\n"
+ "lateral table(RAMP(\"product\".\"product_id\"))";
final String expected = "SELECT *\n"
+ "FROM \"foodmart\".\"product\" AS \"$cor0\",\n"
+ "LATERAL (SELECT *\n"
+ "FROM TABLE(RAMP(\"$cor0\".\"product_id\"))) AS \"t\"";
sql(query).ok(expected);
}

@Test public void testUncollectExplicitAlias() {
final String sql = "select did + 1 \n"
+ "from unnest(select collect(\"department_id\") as deptid"
Expand Down