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 
> 

Reply via email to