I believe that we should allow LATERAL TABLE. Can you log a JIRA case, please?
As a workaround, you might get away with wrapping the table with “(SELECT * FROM … )” Julian > On Jul 6, 2016, at 6:18 PM, Jark <[email protected]> wrote: > > It throws “Encountered "LATERAL TABLE" at line 1, column 38.” exception. > According to the document[1], only query can follow behind LATERAL. > > [1] https://calcite.apache.org/docs/reference.html > <https://calcite.apache.org/docs/reference.html> > > >> 在 2016年7月7日,上午5:44,Julian Hyde <[email protected]> 写道: >> >> I think it’s just a mater of a missing “LATERAL”. Try >> >> SELECT MyTable.*, t.s FROM MyTable, LATERAL TABLE(split(MyTable.a)) AS t(s) >> >> (LATERAL allows an item in the FROM clause to “see” earlier items in the >> FROM clause.) >> >>> On Jul 6, 2016, at 7:40 AM, Jark Wu <[email protected]> wrote: >>> >>> Hi , >>> >>> I want to use calcite to parse UDTF(user-defined table function) but have >>> some problems. Suppose we have registered a UDTF named “split” with a >>> string parameters. Calcite support this : “SELECT * FROM TABLE(split(‘hello >>> world’)) AS t(s)” . >>> >>> However, I want the UDTF accept the other table’s columns such as: “SELECT >>> MyTable.*, t.s FROM MyTable, TABLE(split(MyTable.a)) AS t(s)”, but calcite >>> throws can not find “MyTable” exception. >>> >>> Actually I want to implement something like HIVE UDTF, such as “SELECT >>> posexplode(myCol) AS (pos, myNewCol) FROM myTable” Or >>> “select pos, myNewCol From myTable lateral view posexplode(myCol) as (pos, >>> myNewCol)”. >>> >>> Is there any way to do this in calcite ? >>> >>> - Jark Wu >>> >
