I wonder how to use data in list_transform
Let’s say I have this :
SELECT filename,
min(tpep_pickup_datetime),
max(tpep_pickup_datetime),
avg(total_amount)
FROM read_parquet(
list_transform(
generate_series(1, 6),
n -> format('https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2023-{:02d}.parquet', n)
), filename=true
)
GROUP BY filename
ORDER BY filename;
Let’s say that instead of generate_series(1, 6)
, I get a list calculated in a SQL request, can I use this list in list_transform.
This example does not work. How to make it work ?
with a as (select [1,6] as a_list) -- << Normally, [1,6] would come from data
SELECT filename,
min(tpep_pickup_datetime),
max(tpep_pickup_datetime),
avg(total_amount)
FROM read_parquet(
list_transform(
a.a_list, -- << Change HERE (doesn't work)
n -> format('https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2023-{}.parquet', n)
), filename=true
)
GROUP BY filename
ORDER BY filename;