feat: add epoch, daily, weekly, and monthly agg tables for block_first_seen_by_node#119
Open
feat: add epoch, daily, weekly, and monthly agg tables for block_first_seen_by_node#119
Conversation
…ions for block first seen by node
Savid
reviewed
Nov 6, 2025
Comment on lines
+76
to
+77
| WHERE slot_start_date_time >= toStartOfDay(fromUnixTimestamp({{ .bounds.start }})) | ||
| AND slot_start_date_time < toStartOfDay(fromUnixTimestamp({{ .bounds.end }})) + INTERVAL 1 DAY |
Member
There was a problem hiding this comment.
might be able to do this one too (untested lmao)
WHERE toStartOfDay(slot_start_date_time) IN (
SELECT
arrayJoin(
arrayMap(
x -> toDate(start_time) + x,
range(dateDiff('day', toDate(start_time), toDate(end_time)) + 1)
)
)
FROM
(
SELECT
toDateTime(fromUnixTimestamp({{ .bounds.start }})) AS start_time,
toDateTime(fromUnixTimestamp({{ .bounds.end }})) AS end_time
)
)
Savid
reviewed
Nov 6, 2025
Comment on lines
+78
to
+79
| WHERE slot_start_date_time >= toStartOfWeek(fromUnixTimestamp({{ .bounds.start }})) | ||
| AND slot_start_date_time < toStartOfWeek(fromUnixTimestamp({{ .bounds.end }})) + INTERVAL 1 WEEK |
Member
There was a problem hiding this comment.
WHERE toStartOfWeek(slot_start_date_time) IN (
SELECT
arrayJoin(
arrayMap(
x -> addWeeks(start_w, x),
range(dateDiff('week', start_w, end_w) + 1)
)
)
FROM
(
SELECT
toStartOfWeek(fromUnixTimestamp({{ .bounds.start }})) AS start_w,
toStartOfWeek(fromUnixTimestamp({{ .bounds.end }})) AS end_w
)
)
untested
Savid
reviewed
Nov 6, 2025
Comment on lines
+78
to
+79
| WHERE slot_start_date_time >= toStartOfMonth(fromUnixTimestamp({{ .bounds.start }})) | ||
| AND slot_start_date_time < toStartOfMonth(fromUnixTimestamp({{ .bounds.end }})) + INTERVAL 1 MONTH |
Member
There was a problem hiding this comment.
WHERE toStartOfMonth(slot_start_date_time) IN (
SELECT
arrayJoin(
arrayMap(
x -> addMonths(start_m, x),
range(dateDiff('month', start_m, end_m) + 1)
)
)
FROM
(
SELECT
toStartOfMonth(fromUnixTimestamp({{ .bounds.start }})) AS start_m,
toStartOfMonth(fromUnixTimestamp({{ .bounds.end }})) AS end_m
)
)
untested
…-cbt into block-seen-by-node-aggs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
insert meme of dog not knowing what its doing