Skip to content

Unnest join need support WITH ORDINALITY #40315

Description

@ImTangYun

Spark support lateral view posexplode to explode array and get an index number of data in array, for example:

select item.a,t.r from tmp.lateral_test1 lateral view posexplode(c3) t as r,item

My table created like this:

CREATE EXTERNAL TABLE tmp.lateral_test(
c3 array<struct<a:string>> COMMENT 'from deserializer')

I know lateral view explode can be transformed as join lateral unnest in starrocks, but how to tansform lateral view posexplode?
Also, in Trino/Prestodb Sql can be transformed as:

SELECT "t1"."item"."a" AS "a", "t1"."r" AS "r"
FROM "tmp"."lateral_test1" AS "$cor0"
CROSS JOIN UNNEST("$cor0"."c3") WITH ORDINALITY AS "t1" ("item", "r")
image

There need a way to support this feature, Thans!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions