with validatorst as (
select address as validator_address,
label as validator_name,
raw_metadata[0]['account_address']::string as Account_Address,
raw_metadata[0]['rank']::string as Rank,
raw_metadata[0]['uptime']['address']::string as Proposer
from osmosis.core.dim_labels
where label_subtype = 'validator'),
voterst as (
select voter,
count (distinct tx_id) as Votes_Count,
count (distinct vote_option) as Options_Count
from osmosis.core.fact_governance_votes
where proposal_id in ('362')
and tx_status = 'SUCCEEDED'
and voter not in (select Account_Address from validatorst)
group by 1),
validatorsvoterst as (
select voter,
count (distinct tx_id) as Votes_Count,
count (distinct vote_option) as Options_Count
from osmosis.core.fact_governance_votes
where proposal_id in ('362')
and tx_status = 'SUCCEEDED'
and voter in (select Account_Address from validatorst)
group by 1)
select 'Regular Voters' as type,
avg (votes_count) as Average_Votes,
avg (options_count) as Average_Options
from voterst
group by 1
union ALL