I would like to create a function that passes a table and filters it, but it doesn't work!
statement 1 define function
CREATE OR REPLACE TABLE FUNCTION sandobx.func(_t array<STRUCT<`id` INT64, `name` STRING>>)
AS (
select * from unnest(_t)
);
statement 2 call function
with t AS (
SELECT *
FROM UNNEST([
Struct(
1 as id, "taro" as name
"taro" as name
),
(2, 'jiro')
])
)
SELECT * FROM sandobx.func(t)
I thought it would behave like a table since it is an array type, but it doesn't seem to be so