Skip to content

Fix BigQuery datetime subtraction in arterial_line_durations.sql#2007

Closed
Chessing234 wants to merge 1 commit into
MIT-LCP:mainfrom
Chessing234:fix/arterial-line-datetime-diff
Closed

Fix BigQuery datetime subtraction in arterial_line_durations.sql#2007
Chessing234 wants to merge 1 commit into
MIT-LCP:mainfrom
Chessing234:fix/arterial-line-datetime-diff

Conversation

@Chessing234
Copy link
Copy Markdown

Bug

Fixes #843. Running mimic-iii/concepts/durations/arterial_line_durations.sql on BigQuery fails with No matching signature for operator - for argument types: DATETIME, DATETIME.

Root cause

Line 134 uses PostgreSQL interval subtraction (charttime - charttime_lag), which BigQuery does not support for DATETIME values.

Why this fix is correct

The same query already uses DATETIME_DIFF(charttime, charttime_lag, HOUR) on line 138 for the related 16-hour threshold check. Replacing the subtraction with the same BigQuery function makes the duration column valid and consistent with the rest of the file.

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@Chessing234 Chessing234 closed this by deleting the head repository May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An error occured when I run the code of 'arterial_line_durations.sql'

1 participant