You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: function unnested (integer) does not exist
LINE 17: CROSS JOIN UNNEST(all_hours.hrs) AS _t(hr_unnested)
^
HINT: There is no function that matches the specified name and parameter type. You may need to add explicit type conversion.
Hi i got the whole pipeline run by editing:
mimic-iv/concepts_postgres/demographics/icustay_hourly.sql
-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.DROPTABLE IF EXISTS mimiciv_derived.icustay_hourly; CREATE TABLE mimiciv_derived.icustay_hourlyAS/* This query generates a row for every hour the patient is in the ICU. *//* The hours are based on clock-hours (i.e. 02:00, 03:00). *//* The hour clock starts 24 hours before the first heart rate measurement. *//* Note that the time of the first heart rate measurement is ceilinged to *//* the hour. *//* this query extracts the cohort and every possible hour they were in the ICU *//* this table can be to other tables on stay_id and (ENDTIME - 1 hour,ENDTIME] *//* get first/last measurement time */
WITH all_hours AS (
SELECTit.stay_id, /* round the intime up to the nearest hour */
CASE
WHEN DATE_TRUNC('HOUR', it.intime_hr) =it.intime_hr
THEN it.intime_hr
ELSE DATE_TRUNC('HOUR', it.intime_hr) + INTERVAL '1 HOUR'
END AS endtime, /* create integers for each charttime in hours from admission *//* so 0 is admission time, 1 is one hour after admission, etc, *//* up to ICU disch *//* we allow 24 hours before ICU admission (to grab labs before admit) */
GENERATE_SERIES(-24, CAST(CEIL(EXTRACT(EPOCH FROMit.outtime_hr-it.intime_hr) /3600.0) ASINT)) AS hrs /* noqa: L016 */FROMmimiciv_derived.icustay_timesAS it
)
SELECT
stay_id,
CAST(all_hours.hrsASBIGINT) AS hr,
endtime + CAST(all_hours.hrsASBIGINT) * INTERVAL '1 HOUR'AS endtime
FROM all_hours
-- CROSS JOIN UNNEST(all_hours.hrs) AS _t(hr_unnested)
On current main, postgres icustay_hourly wraps GENERATE_SERIES in ARRAY(...) before UNNEST, which should avoid unnest(integer). If you still hit it, re-pull concepts_postgres/demographics/icustay_hourly.sql.
Activity
HuilingHU commentedon Apr 30, 2024
you can try:
the last line of the icustay_hourly.sql----> CROSS JOIN UNNEST(array[all_hours.hrs]) AS _t(hr_unnested)
theompm commentedon Jul 23, 2024
Hi i got the whole pipeline run by editing:
mimic-iv/concepts_postgres/demographics/icustay_hourly.sql
chessing234 commentedon Jul 16, 2026
On current
main, postgresicustay_hourlywrapsGENERATE_SERIESinARRAY(...)beforeUNNEST, which should avoidunnest(integer). If you still hit it, re-pullconcepts_postgres/demographics/icustay_hourly.sql.chessing234 commentedon Jul 16, 2026
Also covered for DuckDB in #2060 —
GENERATE_ARRAYnow transpiles to alist(...)soUNNESTworks.alistairewj commentedon Jul 18, 2026
fixed in recent transpilation work
fix: keep DuckDB GENERATE_ARRAY as a list for UNNEST