Skip to content

Commit d809c8b

Browse files
Fix Dremio: rename 'prev' alias to 'prev_b' (reserved keyword in Dremio)
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
1 parent 6c5968e commit d809c8b

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

macros/edr/tests/test_volume_threshold.sql

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,26 +216,27 @@
216216
comparison as (
217217
select
218218
curr.bucket_end as current_period,
219-
prev.bucket_end as previous_period,
219+
prev_b.bucket_end as previous_period,
220220
{{ elementary.edr_cast_as_int("curr.row_count") }} as current_row_count,
221-
{{ elementary.edr_cast_as_int("prev.row_count") }}
221+
{{ elementary.edr_cast_as_int("prev_b.row_count") }}
222222
as previous_row_count,
223223
case
224-
when prev.row_count is null or prev.row_count = 0
224+
when prev_b.row_count is null or prev_b.row_count = 0
225225
then null
226226
else
227227
round(
228228
cast(
229-
(curr.row_count - prev.row_count)
229+
(curr.row_count - prev_b.row_count)
230230
* 100.0
231-
/ prev.row_count as {{ elementary.edr_type_numeric() }}
231+
/ prev_b.row_count
232+
as {{ elementary.edr_type_numeric() }}
232233
),
233234
2
234235
)
235236
end as percent_change
236237
from bucket_numbered curr
237238
inner join max_bucket on curr.bucket_num = max_bucket.max_num
238-
left join bucket_numbered prev on prev.bucket_num = curr.bucket_num - 1
239+
left join bucket_numbered prev_b on prev_b.bucket_num = curr.bucket_num - 1
239240
),
240241
241242
volume_result as (

0 commit comments

Comments
 (0)