Community Juicetopic2
Updated 2023-11-01
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
›
⌄
with t1 as (SELECT a.tx_hash
, a.block_timestamp
, a.signer_id AS commenter_account_id
, try_parse_json(a.node_data[k.value]) AS action_data
, action_data:item:blockHeight::integer AS post_block_height
, action_data:item:path::string AS post_path
, split(post_path, '/')[0]::string AS post_author_account_id
, action_data:item:type::string AS post_type
FROM near.social.fact_decoded_actions AS a
, LATERAL FLATTEN (input => (CASE WHEN is_object(a.node_data) THEN object_keys(a.node_data) ELSE NULL END)) AS k
WHERE a.node = 'post'
AND k.value = 'comment'
AND post_type = 'social'
and BLOCK_TIMESTAMP >= CURRENT_DATE - {{Time_period_days}}
)
select
distinct post_author_account_id as "Author",
count(distinct tx_hash) as no_comments
from t1
group by 1
order by 2 desc limit 10
Run a query to Download Data