-
Notifications
You must be signed in to change notification settings - Fork 302
Table Value Function
yuyang edited this page Nov 2, 2022
·
3 revisions
TVF是Table Value Function的缩写。
TVF在TuringSQL中用来表示一类可以对整张表进行操作的函数集合。其的输入由一个或者若干个标量参数和一个SQL(可以理解为一张表)组成;与之对应的输出是一张表。
SELECT:
SELECT [ DISTINCT ]
{ * | projectItem [, projectItem ]* }
FROM Table({TVF})
[ WHERE booleanExpression ]
[ GROUP BY { groupItem [, groupItem ]* } ]
[ ORDER BY { orderByItem [, OrderByItem ]* }]
[ HAVING booleanExpression ]
[ LIMIT number]
[ OFFSET number]
TVF:
{TVF Name}({scalar parameter}*, {SELECT})
SELECT
*
FROM
TABLE (
one_part_tvf(
'rtp_url',
123,
(
SELECT i1, i2, d3, d4 FROM t1
)
)
)
TVF目前不允许按照如下的方式嵌套:
SELECT
*
from
TABLE (
tvf1(
tvf2(
(
select
*
from
t1
)
)
)
)
但允许下面的方式:
SELECT
*
FROM
TABLE (
one_part_tvf_enable_shuffle(
'rtp_url',
123,
(
SELECT
i1, i2
FROM
TABLE (
one_part_tvf_enable_shuffle(
'rtp_url_2',
234,
(
SELECT i1, i2, d3, d4 FROM t1
)
)
)
)
)
)