[ 
https://issues.apache.org/jira/browse/SPARK-29947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16978091#comment-16978091
 ] 

Yuming Wang commented on SPARK-29947:
-------------------------------------


{code:sql}
CREATE TABLE table1 (`rev_rollup_id` SMALLINT, `rev_rollup` STRING, 
`rev_rollup_name` STRING, `curncy_id` DECIMAL(4,0), `holding_company` 
DECIMAL(9,0), `company_code` DECIMAL(9,0), `business_unit` DECIMAL(9,0), 
`dept_code` STRING, `online` DECIMAL(9,0), `premier` DECIMAL(9,0), `partner` 
DECIMAL(9,0), `real_estate` DECIMAL(9,0), `legal_entity_id` DECIMAL(4,0), 
`src_rev_rollup_id` SMALLINT, `prft_cntr` DECIMAL(9,0), `mngrl_cntry_id` 
STRING, `cre_date` DATE, `upd_date` TIMESTAMP, `cre_user` STRING, `upd_user` 
STRING, `pb_min_succ_bid_count` INT, `pb_enbld_yn_id` TINYINT, 
`sap_prft_cntr_id` INT)
USING parquet;

CREATE TABLE table2 (`cntry_id` DECIMAL(4,0), `curncy_id` DECIMAL(4,0), 
`cntry_desc` STRING, `cntry_code` STRING, `iso_cntry_code` STRING, `cultural` 
STRING, `cntry_busn_unit` STRING, `high_vol_cntry_yn_id` TINYINT, `check_sil` 
TINYINT, `rev_rollup_id` SMALLINT, `rev_rollup` STRING, `prft_cntr_id` INT, 
`prft_cntr` STRING, `cre_date` DATE, `upd_date` TIMESTAMP, `cre_user` STRING, 
`upd_user` STRING)
USING parquet;

CREATE TABLE table3 (`CURNCY_ID` DECIMAL(9,0), `CURNCY_PLAN_RATE` 
DECIMAL(18,6), `CRE_DATE` DATE, `CRE_USER` STRING, `UPD_DATE` TIMESTAMP, 
`UPD_USER` STRING)
USING parquet;

CREATE TABLE table4(`adj_type_id` tinyint, `byr_cntry_id` decimal(4,0), 
`sap_category_id` decimal(9,0), `lstg_site_id` decimal(9,0), `lstg_type_code` 
decimal(4,0), `offrd_slng_chnl_grp_id` smallint, `slr_cntry_id` decimal(4,0), 
`sold_slng_chnl_grp_id` smallint, `bin_lstg_yn_id` tinyint, `bin_sold_yn_id` 
tinyint, `lstg_curncy_id` decimal(4,0), `blng_curncy_id` decimal(4,0), 
`bid_count` decimal(18,0), `ck_trans_count` decimal(18,0), `ended_bid_count` 
decimal(18,0), `new_lstg_count` decimal(18,0), `ended_lstg_count` 
decimal(18,0), `ended_success_lstg_count` decimal(18,0), `item_sold_count` 
decimal(18,0), `gmv_us_amt` decimal(18,2), `gmv_byr_lc_amt` decimal(18,2), 
`gmv_slr_lc_amt` decimal(18,2), `gmv_lstg_curncy_amt` decimal(18,2), 
`gmv_us_m_amt` decimal(18,2), `rvnu_insrtn_fee_us_amt` decimal(18,6), 
`rvnu_insrtn_fee_lc_amt` decimal(18,6), `rvnu_insrtn_fee_bc_amt` decimal(18,6), 
`rvnu_insrtn_fee_us_m_amt` decimal(18,6), `rvnu_insrtn_crd_us_amt` 
decimal(18,6), `rvnu_insrtn_crd_lc_amt` decimal(18,6), `rvnu_insrtn_crd_bc_amt` 
decimal(18,6), `rvnu_insrtn_crd_us_m_amt` decimal(18,6), `rvnu_fetr_fee_us_amt` 
decimal(18,6), `rvnu_fetr_fee_lc_amt` decimal(18,6), `rvnu_fetr_fee_bc_amt` 
decimal(18,6), `rvnu_fetr_fee_us_m_amt` decimal(18,6), `rvnu_fetr_crd_us_amt` 
decimal(18,6), `rvnu_fetr_crd_lc_amt` decimal(18,6), `rvnu_fetr_crd_bc_amt` 
decimal(18,6), `rvnu_fetr_crd_us_m_amt` decimal(18,6), `rvnu_fv_fee_us_amt` 
decimal(18,6), `rvnu_fv_fee_slr_lc_amt` decimal(18,6), `rvnu_fv_fee_byr_lc_amt` 
decimal(18,6), `rvnu_fv_fee_bc_amt` decimal(18,6), `rvnu_fv_fee_us_m_amt` 
decimal(18,6), `rvnu_fv_crd_us_amt` decimal(18,6), `rvnu_fv_crd_byr_lc_amt` 
decimal(18,6), `rvnu_fv_crd_slr_lc_amt` decimal(18,6), `rvnu_fv_crd_bc_amt` 
decimal(18,6), `rvnu_fv_crd_us_m_amt` decimal(18,6), `rvnu_othr_l_fee_us_amt` 
decimal(18,6), `rvnu_othr_l_fee_lc_amt` decimal(18,6), `rvnu_othr_l_fee_bc_amt` 
decimal(18,6), `rvnu_othr_l_fee_us_m_amt` decimal(18,6), 
`rvnu_othr_l_crd_us_amt` decimal(18,6), `rvnu_othr_l_crd_lc_amt` decimal(18,6), 
`rvnu_othr_l_crd_bc_amt` decimal(18,6), `rvnu_othr_l_crd_us_m_amt` 
decimal(18,6), `rvnu_othr_nl_fee_us_amt` decimal(18,6), 
`rvnu_othr_nl_fee_lc_amt` decimal(18,6), `rvnu_othr_nl_fee_bc_amt` 
decimal(18,6), `rvnu_othr_nl_fee_us_m_amt` decimal(18,6), 
`rvnu_othr_nl_crd_us_amt` decimal(18,6), `rvnu_othr_nl_crd_lc_amt` 
decimal(18,6), `rvnu_othr_nl_crd_bc_amt` decimal(18,6), 
`rvnu_othr_nl_crd_us_m_amt` decimal(18,6), `rvnu_slr_tools_fee_us_amt` 
decimal(18,6), `rvnu_slr_tools_fee_lc_amt` decimal(18,6), 
`rvnu_slr_tools_fee_bc_amt` decimal(18,6), `rvnu_slr_tools_fee_us_m_amt` 
decimal(18,6), `rvnu_slr_tools_crd_us_amt` decimal(18,6), 
`rvnu_slr_tools_crd_lc_amt` decimal(18,6), `rvnu_slr_tools_crd_bc_amt` 
decimal(18,6), `rvnu_slr_tools_crd_us_m_amt` decimal(18,6), 
`rvnu_unasgnd_us_amt` decimal(18,6), `rvnu_unasgnd_lc_amt` decimal(18,6), 
`rvnu_unasgnd_bc_amt` decimal(18,6), `rvnu_unasgnd_us_m_amt` decimal(18,6), 
`rvnu_ad_fee_us_amt` decimal(18,6), `rvnu_ad_fee_lc_amt` decimal(18,6), 
`rvnu_ad_fee_bc_amt` decimal(18,6), `rvnu_ad_fee_us_m_amt` decimal(18,6), 
`rvnu_ad_crd_us_amt` decimal(18,6), `rvnu_ad_crd_lc_amt` decimal(18,6), 
`rvnu_ad_crd_bc_amt` decimal(18,6), `rvnu_ad_crd_us_m_amt` decimal(18,6), 
`rvnu_othr_ad_fee_us_amt` decimal(18,6), `rvnu_othr_ad_fee_lc_amt` 
decimal(18,6), `rvnu_othr_ad_fee_bc_amt` decimal(18,6), 
`rvnu_othr_ad_fee_us_m_amt` decimal(18,6), `cre_date` date, `cre_user` string, 
`upd_date` timestamp, `upd_user` string, `cmn_mtrc_summ_dt` date)
USING parquet;

CREATE VIEW view1(cmn_mtrc_summ_dt, adj_type_id, byr_cntry_id, sap_category_id, 
lstg_site_id, lstg_type_code, offrd_slng_chnl_grp_id, slr_cntry_id, 
sold_slng_chnl_grp_id, bin_lstg_yn_id, bin_sold_yn_id, lstg_curncy_id, 
blng_curncy_id, bid_count, ck_trans_count, ended_bid_count, ended_lstg_count, 
ended_success_lstg_count, item_sold_count, new_lstg_count, gmv_us_amt, 
gmv_slr_lc_amt, gmv_byr_lc_amt, gmv_lstg_curncy_amt, gmv_us_m_amt, 
rvnu_insrtn_fee_us_amt, rvnu_insrtn_fee_lc_amt, rvnu_insrtn_fee_bc_amt, 
rvnu_insrtn_fee_us_m_amt, rvnu_insrtn_crd_us_amt, rvnu_insrtn_crd_lc_amt, 
rvnu_insrtn_crd_bc_amt, rvnu_insrtn_crd_us_m_amt, rvnu_fetr_fee_us_amt, 
rvnu_fetr_fee_lc_amt, rvnu_fetr_fee_bc_amt, rvnu_fetr_fee_us_m_amt, 
rvnu_fetr_crd_us_amt, rvnu_fetr_crd_lc_amt, rvnu_fetr_crd_bc_amt, 
rvnu_fetr_crd_us_m_amt, rvnu_fv_fee_us_amt, rvnu_fv_fee_byr_lc_amt, 
rvnu_fv_fee_slr_lc_amt, rvnu_fv_fee_bc_amt, rvnu_fv_fee_us_m_amt, 
rvnu_fv_crd_us_amt, rvnu_fv_crd_byr_lc_amt, rvnu_fv_crd_slr_lc_amt, 
rvnu_fv_crd_bc_amt, rvnu_fv_crd_us_m_amt, rvnu_othr_l_fee_us_amt, 
rvnu_othr_l_fee_lc_amt, rvnu_othr_l_fee_bc_amt, rvnu_othr_l_fee_us_m_amt, 
rvnu_othr_l_crd_us_amt, rvnu_othr_l_crd_lc_amt, rvnu_othr_l_crd_bc_amt, 
rvnu_othr_l_crd_us_m_amt, rvnu_othr_nl_fee_us_amt, rvnu_othr_nl_fee_lc_amt, 
rvnu_othr_nl_fee_bc_amt, rvnu_othr_nl_fee_us_m_amt, rvnu_othr_nl_crd_us_amt, 
rvnu_othr_nl_crd_lc_amt, rvnu_othr_nl_crd_bc_amt, rvnu_othr_nl_crd_us_m_amt, 
rvnu_slr_tools_fee_us_amt, rvnu_slr_tools_fee_lc_amt, 
rvnu_slr_tools_fee_bc_amt, rvnu_slr_tools_fee_us_m_amt, 
rvnu_slr_tools_crd_us_amt, rvnu_slr_tools_crd_lc_amt, 
rvnu_slr_tools_crd_bc_amt, rvnu_slr_tools_crd_us_m_amt, rvnu_unasgnd_us_amt, 
rvnu_unasgnd_lc_amt, rvnu_unasgnd_bc_amt, rvnu_unasgnd_us_m_amt, 
rvnu_ad_fee_us_amt, rvnu_ad_fee_lc_amt, rvnu_ad_fee_bc_amt, 
rvnu_ad_fee_us_m_amt, rvnu_ad_crd_us_amt, rvnu_ad_crd_lc_amt, 
rvnu_ad_crd_bc_amt, rvnu_ad_crd_us_m_amt, rvnu_othr_ad_fee_us_amt, 
rvnu_othr_ad_fee_lc_amt, rvnu_othr_ad_fee_bc_amt, rvnu_othr_ad_fee_us_m_amt, 
rvnu_transaction_us_amt, rvnu_transaction_lc_amt, rvnu_transaction_bc_amt, 
rvnu_transaction_crd_us_amt, rvnu_transaction_crd_lc_amt, 
rvnu_transaction_crd_bc_amt, rvnu_total_us_amt, rvnu_total_lc_amt, 
rvnu_total_bc_amt, rvnu_total_crd_us_amt, rvnu_total_crd_lc_amt, 
rvnu_total_crd_bc_amt, gmv_usd_plan_amt, gmv_slr_lc_plan_amt, 
gmv_byr_lc_plan_amt, rvnu_insrtn_fee_usd_plan_amt, 
rvnu_insrtn_crd_usd_plan_amt, rvnu_fetr_fee_usd_plan_amt, 
rvnu_fetr_crd_usd_plan_amt, rvnu_fv_fee_usd_plan_amt, rvnu_fv_crd_usd_plan_amt, 
rvnu_othr_l_fee_usd_plan_amt, rvnu_othr_l_crd_usd_plan_amt, 
rvnu_othr_nl_fee_usd_plan_amt, rvnu_othr_nl_crd_usd_plan_amt, 
rvnu_slr_tls_fee_usd_plan_amt, rvnu_slr_tls_crd_usd_plan_amt, 
rvnu_unasgnd_usd_plan_amt, rvnu_ad_fee_usd_plan_amt, rvnu_ad_crd_usd_plan_amt, 
rvnu_othr_ad_fee_usd_plan_amt, rvnu_trans_usd_plan_amt, 
rvnu_trans_crd_usd_plan_amt, rvnu_total_usd_plan_amt, 
rvnu_total_crd_usd_plan_amt, rvnu_insrtn_fee_lc_plan_amt, 
rvnu_insrtn_crd_lc_plan_amt, rvnu_fetr_fee_lc_plan_amt, 
rvnu_fetr_crd_lc_plan_amt, rvnu_fv_fee_lc_plan_amt, rvnu_fv_crd_lc_plan_amt, 
rvnu_othr_l_fee_lc_plan_amt, rvnu_othr_l_crd_lc_plan_amt, 
rvnu_othr_nl_fee_lc_plan_amt, rvnu_othr_nl_crd_lc_plan_amt, 
rvnu_slr_tls_fee_lc_plan_amt, rvnu_slr_tls_crd_lc_plan_amt, 
rvnu_unasgnd_lc_plan_amt, rvnu_ad_fee_lc_plan_amt, rvnu_ad_crd_lc_plan_amt, 
rvnu_othr_ad_fee_lc_plan_amt, rvnu_trans_lc_plan_amt, 
rvnu_trans_crd_lc_plan_amt, rvnu_total_lc_plan_amt, rvnu_total_crd_lc_plan_amt, 
cre_date, cre_user, upd_date, upd_user) AS
SELECT gen_attr_0 AS cmn_mtrc_summ_dt, gen_attr_2 AS adj_type_id, gen_attr_4 AS 
byr_cntry_id, gen_attr_6 AS sap_category_id, gen_attr_8 AS lstg_site_id, 
gen_attr_10 AS lstg_type_code, gen_attr_12 AS offrd_slng_chnl_grp_id, 
gen_attr_14 AS slr_cntry_id, gen_attr_16 AS sold_slng_chnl_grp_id, gen_attr_18 
AS bin_lstg_yn_id, gen_attr_20 AS bin_sold_yn_id, gen_attr_22 AS 
lstg_curncy_id, gen_attr_24 AS blng_curncy_id, gen_attr_26 AS bid_count, 
gen_attr_28 AS ck_trans_count, gen_attr_30 AS ended_bid_count, gen_attr_32 AS 
ended_lstg_count, gen_attr_34 AS ended_success_lstg_count, gen_attr_36 AS 
item_sold_count, gen_attr_38 AS new_lstg_count, gen_attr_40 AS gmv_us_amt, 
gen_attr_42 AS gmv_slr_lc_amt, gen_attr_44 AS gmv_byr_lc_amt, gen_attr_46 AS 
gmv_lstg_curncy_amt, gen_attr_48 AS gmv_us_m_amt, gen_attr_50 AS 
rvnu_insrtn_fee_us_amt, gen_attr_52 AS rvnu_insrtn_fee_lc_amt, gen_attr_54 AS 
rvnu_insrtn_fee_bc_amt, gen_attr_56 AS rvnu_insrtn_fee_us_m_amt, gen_attr_58 AS 
rvnu_insrtn_crd_us_amt, gen_attr_60 AS rvnu_insrtn_crd_lc_amt, gen_attr_62 AS 
rvnu_insrtn_crd_bc_amt, gen_attr_64 AS rvnu_insrtn_crd_us_m_amt, gen_attr_66 AS 
rvnu_fetr_fee_us_amt, gen_attr_68 AS rvnu_fetr_fee_lc_amt, gen_attr_70 AS 
rvnu_fetr_fee_bc_amt, gen_attr_72 AS rvnu_fetr_fee_us_m_amt, gen_attr_74 AS 
rvnu_fetr_crd_us_amt, gen_attr_76 AS rvnu_fetr_crd_lc_amt, gen_attr_78 AS 
rvnu_fetr_crd_bc_amt, gen_attr_80 AS rvnu_fetr_crd_us_m_amt, gen_attr_82 AS 
rvnu_fv_fee_us_amt, gen_attr_84 AS rvnu_fv_fee_byr_lc_amt, gen_attr_86 AS 
rvnu_fv_fee_slr_lc_amt, gen_attr_88 AS rvnu_fv_fee_bc_amt, gen_attr_90 AS 
rvnu_fv_fee_us_m_amt, gen_attr_92 AS rvnu_fv_crd_us_amt, gen_attr_94 AS 
rvnu_fv_crd_byr_lc_amt, gen_attr_96 AS rvnu_fv_crd_slr_lc_amt, gen_attr_98 AS 
rvnu_fv_crd_bc_amt, gen_attr_100 AS rvnu_fv_crd_us_m_amt, gen_attr_102 AS 
rvnu_othr_l_fee_us_amt, gen_attr_104 AS rvnu_othr_l_fee_lc_amt, gen_attr_106 AS 
rvnu_othr_l_fee_bc_amt, gen_attr_108 AS rvnu_othr_l_fee_us_m_amt, gen_attr_110 
AS rvnu_othr_l_crd_us_amt, gen_attr_112 AS rvnu_othr_l_crd_lc_amt, gen_attr_114 
AS rvnu_othr_l_crd_bc_amt, gen_attr_116 AS rvnu_othr_l_crd_us_m_amt, 
gen_attr_118 AS rvnu_othr_nl_fee_us_amt, gen_attr_120 AS 
rvnu_othr_nl_fee_lc_amt, gen_attr_122 AS rvnu_othr_nl_fee_bc_amt, gen_attr_124 
AS rvnu_othr_nl_fee_us_m_amt, gen_attr_126 AS rvnu_othr_nl_crd_us_amt, 
gen_attr_128 AS rvnu_othr_nl_crd_lc_amt, gen_attr_130 AS 
rvnu_othr_nl_crd_bc_amt, gen_attr_132 AS rvnu_othr_nl_crd_us_m_amt, 
gen_attr_134 AS rvnu_slr_tools_fee_us_amt, gen_attr_136 AS 
rvnu_slr_tools_fee_lc_amt, gen_attr_138 AS rvnu_slr_tools_fee_bc_amt, 
gen_attr_140 AS rvnu_slr_tools_fee_us_m_amt, gen_attr_142 AS 
rvnu_slr_tools_crd_us_amt, gen_attr_144 AS rvnu_slr_tools_crd_lc_amt, 
gen_attr_146 AS rvnu_slr_tools_crd_bc_amt, gen_attr_148 AS 
rvnu_slr_tools_crd_us_m_amt, gen_attr_150 AS rvnu_unasgnd_us_amt, gen_attr_152 
AS rvnu_unasgnd_lc_amt, gen_attr_154 AS rvnu_unasgnd_bc_amt, gen_attr_156 AS 
rvnu_unasgnd_us_m_amt, gen_attr_158 AS rvnu_ad_fee_us_amt, gen_attr_160 AS 
rvnu_ad_fee_lc_amt, gen_attr_162 AS rvnu_ad_fee_bc_amt, gen_attr_164 AS 
rvnu_ad_fee_us_m_amt, gen_attr_166 AS rvnu_ad_crd_us_amt, gen_attr_168 AS 
rvnu_ad_crd_lc_amt, gen_attr_170 AS rvnu_ad_crd_bc_amt, gen_attr_172 AS 
rvnu_ad_crd_us_m_amt, gen_attr_174 AS rvnu_othr_ad_fee_us_amt, gen_attr_176 AS 
rvnu_othr_ad_fee_lc_amt, gen_attr_178 AS rvnu_othr_ad_fee_bc_amt, gen_attr_180 
AS rvnu_othr_ad_fee_us_m_amt, gen_attr_182 AS rvnu_transaction_us_amt, 
gen_attr_184 AS rvnu_transaction_lc_amt, gen_attr_186 AS 
rvnu_transaction_bc_amt, gen_attr_188 AS rvnu_transaction_crd_us_amt, 
gen_attr_190 AS rvnu_transaction_crd_lc_amt, gen_attr_192 AS 
rvnu_transaction_crd_bc_amt, gen_attr_194 AS rvnu_total_us_amt, gen_attr_196 AS 
rvnu_total_lc_amt, gen_attr_198 AS rvnu_total_bc_amt, gen_attr_200 AS 
rvnu_total_crd_us_amt, gen_attr_202 AS rvnu_total_crd_lc_amt, gen_attr_204 AS 
rvnu_total_crd_bc_amt, gen_attr_206 AS gmv_usd_plan_amt, gen_attr_208 AS 
gmv_slr_lc_plan_amt, gen_attr_210 AS gmv_byr_lc_plan_amt, gen_attr_212 AS 
rvnu_insrtn_fee_usd_plan_amt, gen_attr_214 AS rvnu_insrtn_crd_usd_plan_amt, 
gen_attr_216 AS rvnu_fetr_fee_usd_plan_amt, gen_attr_218 AS 
rvnu_fetr_crd_usd_plan_amt, gen_attr_220 AS rvnu_fv_fee_usd_plan_amt, 
gen_attr_222 AS rvnu_fv_crd_usd_plan_amt, gen_attr_224 AS 
rvnu_othr_l_fee_usd_plan_amt, gen_attr_226 AS rvnu_othr_l_crd_usd_plan_amt, 
gen_attr_228 AS rvnu_othr_nl_fee_usd_plan_amt, gen_attr_230 AS 
rvnu_othr_nl_crd_usd_plan_amt, gen_attr_232 AS rvnu_slr_tls_fee_usd_plan_amt, 
gen_attr_234 AS rvnu_slr_tls_crd_usd_plan_amt, gen_attr_236 AS 
rvnu_unasgnd_usd_plan_amt, gen_attr_238 AS rvnu_ad_fee_usd_plan_amt, 
gen_attr_240 AS rvnu_ad_crd_usd_plan_amt, gen_attr_242 AS 
rvnu_othr_ad_fee_usd_plan_amt, gen_attr_244 AS rvnu_trans_usd_plan_amt, 
gen_attr_246 AS rvnu_trans_crd_usd_plan_amt, gen_attr_248 AS 
rvnu_total_usd_plan_amt, gen_attr_250 AS rvnu_total_crd_usd_plan_amt, 
gen_attr_252 AS rvnu_insrtn_fee_lc_plan_amt, gen_attr_254 AS 
rvnu_insrtn_crd_lc_plan_amt, gen_attr_256 AS rvnu_fetr_fee_lc_plan_amt, 
gen_attr_258 AS rvnu_fetr_crd_lc_plan_amt, gen_attr_260 AS 
rvnu_fv_fee_lc_plan_amt, gen_attr_262 AS rvnu_fv_crd_lc_plan_amt, gen_attr_264 
AS rvnu_othr_l_fee_lc_plan_amt, gen_attr_266 AS rvnu_othr_l_crd_lc_plan_amt, 
gen_attr_268 AS rvnu_othr_nl_fee_lc_plan_amt, gen_attr_270 AS 
rvnu_othr_nl_crd_lc_plan_amt, gen_attr_272 AS rvnu_slr_tls_fee_lc_plan_amt, 
gen_attr_274 AS rvnu_slr_tls_crd_lc_plan_amt, gen_attr_276 AS 
rvnu_unasgnd_lc_plan_amt, gen_attr_278 AS rvnu_ad_fee_lc_plan_amt, gen_attr_280 
AS rvnu_ad_crd_lc_plan_amt, gen_attr_282 AS rvnu_othr_ad_fee_lc_plan_amt, 
gen_attr_284 AS rvnu_trans_lc_plan_amt, gen_attr_286 AS 
rvnu_trans_crd_lc_plan_amt, gen_attr_288 AS rvnu_total_lc_plan_amt, 
gen_attr_290 AS rvnu_total_crd_lc_plan_amt, gen_attr_292 AS cre_date, 
gen_attr_294 AS cre_user, gen_attr_296 AS upd_date, gen_attr_298 AS upd_user 
FROM (SELECT gen_attr_1 AS gen_attr_0, gen_attr_3 AS gen_attr_2, gen_attr_5 AS 
gen_attr_4, gen_attr_7 AS gen_attr_6, gen_attr_9 AS gen_attr_8, gen_attr_11 AS 
gen_attr_10, gen_attr_13 AS gen_attr_12, gen_attr_15 AS gen_attr_14, 
gen_attr_17 AS gen_attr_16, gen_attr_19 AS gen_attr_18, gen_attr_21 AS 
gen_attr_20, gen_attr_23 AS gen_attr_22, gen_attr_25 AS gen_attr_24, 
gen_attr_27 AS gen_attr_26, gen_attr_29 AS gen_attr_28, gen_attr_31 AS 
gen_attr_30, gen_attr_33 AS gen_attr_32, gen_attr_35 AS gen_attr_34, 
gen_attr_37 AS gen_attr_36, gen_attr_39 AS gen_attr_38, gen_attr_41 AS 
gen_attr_40, gen_attr_43 AS gen_attr_42, gen_attr_45 AS gen_attr_44, 
gen_attr_47 AS gen_attr_46, gen_attr_49 AS gen_attr_48, gen_attr_51 AS 
gen_attr_50, gen_attr_53 AS gen_attr_52, gen_attr_55 AS gen_attr_54, 
gen_attr_57 AS gen_attr_56, gen_attr_59 AS gen_attr_58, gen_attr_61 AS 
gen_attr_60, gen_attr_63 AS gen_attr_62, gen_attr_65 AS gen_attr_64, 
gen_attr_67 AS gen_attr_66, gen_attr_69 AS gen_attr_68, gen_attr_71 AS 
gen_attr_70, gen_attr_73 AS gen_attr_72, gen_attr_75 AS gen_attr_74, 
gen_attr_77 AS gen_attr_76, gen_attr_79 AS gen_attr_78, gen_attr_81 AS 
gen_attr_80, gen_attr_83 AS gen_attr_82, gen_attr_85 AS gen_attr_84, 
gen_attr_87 AS gen_attr_86, gen_attr_89 AS gen_attr_88, gen_attr_91 AS 
gen_attr_90, gen_attr_93 AS gen_attr_92, gen_attr_95 AS gen_attr_94, 
gen_attr_97 AS gen_attr_96, gen_attr_99 AS gen_attr_98, gen_attr_101 AS 
gen_attr_100, gen_attr_103 AS gen_attr_102, gen_attr_105 AS gen_attr_104, 
gen_attr_107 AS gen_attr_106, gen_attr_109 AS gen_attr_108, gen_attr_111 AS 
gen_attr_110, gen_attr_113 AS gen_attr_112, gen_attr_115 AS gen_attr_114, 
gen_attr_117 AS gen_attr_116, gen_attr_119 AS gen_attr_118, gen_attr_121 AS 
gen_attr_120, gen_attr_123 AS gen_attr_122, gen_attr_125 AS gen_attr_124, 
gen_attr_127 AS gen_attr_126, gen_attr_129 AS gen_attr_128, gen_attr_131 AS 
gen_attr_130, gen_attr_133 AS gen_attr_132, gen_attr_135 AS gen_attr_134, 
gen_attr_137 AS gen_attr_136, gen_attr_139 AS gen_attr_138, gen_attr_141 AS 
gen_attr_140, gen_attr_143 AS gen_attr_142, gen_attr_145 AS gen_attr_144, 
gen_attr_147 AS gen_attr_146, gen_attr_149 AS gen_attr_148, gen_attr_151 AS 
gen_attr_150, gen_attr_153 AS gen_attr_152, gen_attr_155 AS gen_attr_154, 
gen_attr_157 AS gen_attr_156, gen_attr_159 AS gen_attr_158, gen_attr_161 AS 
gen_attr_160, gen_attr_163 AS gen_attr_162, gen_attr_165 AS gen_attr_164, 
gen_attr_167 AS gen_attr_166, gen_attr_169 AS gen_attr_168, gen_attr_171 AS 
gen_attr_170, gen_attr_173 AS gen_attr_172, gen_attr_175 AS gen_attr_174, 
gen_attr_177 AS gen_attr_176, gen_attr_179 AS gen_attr_178, gen_attr_181 AS 
gen_attr_180, gen_attr_183 AS gen_attr_182, gen_attr_185 AS gen_attr_184, 
gen_attr_187 AS gen_attr_186, gen_attr_189 AS gen_attr_188, gen_attr_191 AS 
gen_attr_190, gen_attr_193 AS gen_attr_192, gen_attr_195 AS gen_attr_194, 
gen_attr_197 AS gen_attr_196, gen_attr_199 AS gen_attr_198, gen_attr_201 AS 
gen_attr_200, gen_attr_203 AS gen_attr_202, gen_attr_205 AS gen_attr_204, 
gen_attr_207 AS gen_attr_206, gen_attr_209 AS gen_attr_208, gen_attr_211 AS 
gen_attr_210, gen_attr_213 AS gen_attr_212, gen_attr_215 AS gen_attr_214, 
gen_attr_217 AS gen_attr_216, gen_attr_219 AS gen_attr_218, gen_attr_221 AS 
gen_attr_220, gen_attr_223 AS gen_attr_222, gen_attr_225 AS gen_attr_224, 
gen_attr_227 AS gen_attr_226, gen_attr_229 AS gen_attr_228, gen_attr_231 AS 
gen_attr_230, gen_attr_233 AS gen_attr_232, gen_attr_235 AS gen_attr_234, 
gen_attr_237 AS gen_attr_236, gen_attr_239 AS gen_attr_238, gen_attr_241 AS 
gen_attr_240, gen_attr_243 AS gen_attr_242, gen_attr_245 AS gen_attr_244, 
gen_attr_247 AS gen_attr_246, gen_attr_249 AS gen_attr_248, gen_attr_251 AS 
gen_attr_250, gen_attr_253 AS gen_attr_252, gen_attr_255 AS gen_attr_254, 
gen_attr_257 AS gen_attr_256, gen_attr_259 AS gen_attr_258, gen_attr_261 AS 
gen_attr_260, gen_attr_263 AS gen_attr_262, gen_attr_265 AS gen_attr_264, 
gen_attr_267 AS gen_attr_266, gen_attr_269 AS gen_attr_268, gen_attr_271 AS 
gen_attr_270, gen_attr_273 AS gen_attr_272, gen_attr_275 AS gen_attr_274, 
gen_attr_277 AS gen_attr_276, gen_attr_279 AS gen_attr_278, gen_attr_281 AS 
gen_attr_280, gen_attr_283 AS gen_attr_282, gen_attr_285 AS gen_attr_284, 
gen_attr_287 AS gen_attr_286, gen_attr_289 AS gen_attr_288, gen_attr_291 AS 
gen_attr_290, gen_attr_293 AS gen_attr_292, gen_attr_295 AS gen_attr_294, 
gen_attr_297 AS gen_attr_296, gen_attr_299 AS gen_attr_298 FROM (SELECT 
gen_attr_1, gen_attr_3, gen_attr_5, gen_attr_7, gen_attr_9, gen_attr_11, 
gen_attr_13, gen_attr_15, gen_attr_17, gen_attr_19, gen_attr_21, gen_attr_23, 
gen_attr_25, gen_attr_27, gen_attr_29, gen_attr_31, gen_attr_33, gen_attr_35, 
gen_attr_37, gen_attr_39, gen_attr_41, gen_attr_43, gen_attr_45, gen_attr_47, 
gen_attr_49, gen_attr_51, gen_attr_53, gen_attr_55, gen_attr_57, gen_attr_59, 
gen_attr_61, gen_attr_63, gen_attr_65, gen_attr_67, gen_attr_69, gen_attr_71, 
gen_attr_73, gen_attr_75, gen_attr_77, gen_attr_79, gen_attr_81, gen_attr_83, 
gen_attr_85, gen_attr_87, gen_attr_89, gen_attr_91, gen_attr_93, gen_attr_95, 
gen_attr_97, gen_attr_99, gen_attr_101, gen_attr_103, gen_attr_105, 
gen_attr_107, gen_attr_109, gen_attr_111, gen_attr_113, gen_attr_115, 
gen_attr_117, gen_attr_119, gen_attr_121, gen_attr_123, gen_attr_125, 
gen_attr_127, gen_attr_129, gen_attr_131, gen_attr_133, gen_attr_135, 
gen_attr_137, gen_attr_139, gen_attr_141, gen_attr_143, gen_attr_145, 
gen_attr_147, gen_attr_149, gen_attr_151, gen_attr_153, gen_attr_155, 
gen_attr_157, gen_attr_159, gen_attr_161, gen_attr_163, gen_attr_165, 
gen_attr_167, gen_attr_169, gen_attr_171, gen_attr_173, gen_attr_175, 
gen_attr_177, gen_attr_179, gen_attr_181, (((coalesce(CAST(gen_attr_51 AS 
DOUBLE), CAST(0 AS DOUBLE)) + coalesce(CAST(gen_attr_67 AS DOUBLE), CAST(0 AS 
DOUBLE))) + coalesce(CAST(gen_attr_83 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_103 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_183, 
(((coalesce(CAST(gen_attr_53 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_69 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_87 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_105 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_185, 
(((coalesce(CAST(gen_attr_55 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_71 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_89 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_107 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_187, 
(((coalesce(CAST(gen_attr_59 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_75 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_93 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_111 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_189, 
(((coalesce(CAST(gen_attr_61 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_77 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_97 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_113 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_191, 
(((coalesce(CAST(gen_attr_63 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_79 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_99 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_115 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_193, 
((((((((coalesce(CAST(gen_attr_51 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_67 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_83 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_103 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_119 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_135 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_151 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_159 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_175 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_195, 
((((((((coalesce(CAST(gen_attr_53 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_69 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_87 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_105 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_121 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_137 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_153 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_161 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_177 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_197, 
((((((((coalesce(CAST(gen_attr_55 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_71 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_89 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_107 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_123 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_139 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_155 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_163 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_179 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_199, 
((((((coalesce(CAST(gen_attr_59 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_75 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_93 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_111 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_127 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_143 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_167 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_201, 
((((((coalesce(CAST(gen_attr_61 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_77 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_97 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_113 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_129 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_145 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_169 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_203, 
((((((coalesce(CAST(gen_attr_63 AS DOUBLE), CAST(0 AS DOUBLE)) + 
coalesce(CAST(gen_attr_79 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_99 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_115 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_131 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_147 AS DOUBLE), CAST(0 AS DOUBLE))) + 
coalesce(CAST(gen_attr_171 AS DOUBLE), CAST(0 AS DOUBLE))) AS gen_attr_205, 
CAST((gen_attr_47 * CAST(gen_attr_300 AS DOUBLE)) AS DECIMAL(18,6)) AS 
gen_attr_207, CAST(((gen_attr_47 * CAST(gen_attr_300 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_209, 
CAST(((gen_attr_47 * CAST(gen_attr_300 AS DOUBLE)) / CAST(gen_attr_302 AS 
DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_211, CAST((gen_attr_55 * 
CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_213, 
CAST((gen_attr_63 * CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS 
gen_attr_215, CAST((gen_attr_71 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS gen_attr_217, CAST((gen_attr_79 * CAST(gen_attr_303 AS 
DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_219, CAST((gen_attr_89 * 
CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_221, 
CAST((gen_attr_99 * CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS 
gen_attr_223, CAST((gen_attr_107 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS gen_attr_225, CAST((gen_attr_115 * CAST(gen_attr_303 AS 
DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_227, CAST((gen_attr_123 * 
CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_229, 
CAST((gen_attr_131 * CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS 
gen_attr_231, CAST((gen_attr_139 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS gen_attr_233, CAST((gen_attr_147 * CAST(gen_attr_303 AS 
DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_235, CAST((gen_attr_155 * 
CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_237, 
CAST((gen_attr_163 * CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS 
gen_attr_239, CAST((gen_attr_171 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS gen_attr_241, CAST((gen_attr_179 * CAST(gen_attr_303 AS 
DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_243, 
coalesce(CAST((CAST(CAST((CAST(CAST((CAST(CAST(CAST((gen_attr_55 * 
CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_71 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_89 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_107 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)), 
CAST(0 AS DECIMAL(19,6))) AS gen_attr_245, 
coalesce(CAST((CAST(CAST((CAST(CAST((CAST(CAST(CAST((gen_attr_63 * 
CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_79 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_99 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_115 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)), 
CAST(0 AS DECIMAL(19,6))) AS gen_attr_247, 
coalesce(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST(CAST((gen_attr_55
 * CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_71 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_89 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_107 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_123 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_139 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_155 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_163 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_179 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)), 
CAST(0 AS DECIMAL(19,6))) AS gen_attr_249, 
coalesce(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST(CAST((gen_attr_63
 * CAST(gen_attr_303 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_79 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_99 * CAST(gen_attr_303 AS DOUBLE)) AS 
DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_115 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_131 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_147 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS 
DECIMAL(20,6)) + CAST(CAST(CAST((gen_attr_171 * CAST(gen_attr_303 AS DOUBLE)) 
AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)), 
CAST(0 AS DECIMAL(19,6))) AS gen_attr_251, CAST(((gen_attr_55 * 
CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) 
AS gen_attr_253, CAST(((gen_attr_63 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_255, 
CAST(((gen_attr_71 * CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS 
DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_257, CAST(((gen_attr_79 * 
CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) 
AS gen_attr_259, CAST(((gen_attr_89 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_261, 
CAST(((gen_attr_99 * CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS 
DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_263, CAST(((gen_attr_107 * 
CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) 
AS gen_attr_265, CAST(((gen_attr_115 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_267, 
CAST(((gen_attr_123 * CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS 
DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_269, CAST(((gen_attr_131 * 
CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) 
AS gen_attr_271, CAST(((gen_attr_139 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_273, 
CAST(((gen_attr_147 * CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS 
DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_275, CAST(((gen_attr_155 * 
CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) 
AS gen_attr_277, CAST(((gen_attr_163 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_279, 
CAST(((gen_attr_171 * CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS 
DOUBLE)) AS DECIMAL(18,6)) AS gen_attr_281, CAST(((gen_attr_179 * 
CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) 
AS gen_attr_283, 
coalesce(CAST((CAST(CAST((CAST(CAST((CAST(CAST(CAST(((gen_attr_55 * 
CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) 
AS DECIMAL(19,6)) AS DECIMAL(20,6)) + CAST(CAST(CAST(((gen_attr_71 * 
CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) 
AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_89 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_107 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)), CAST(0 AS DECIMAL(19,6))) AS gen_attr_285, 
coalesce(CAST((CAST(CAST((CAST(CAST((CAST(CAST(CAST(((gen_attr_63 * 
CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) 
AS DECIMAL(19,6)) AS DECIMAL(20,6)) + CAST(CAST(CAST(((gen_attr_79 * 
CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) 
AS DECIMAL(19,6)) AS DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_99 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_115 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)), CAST(0 AS DECIMAL(19,6))) AS gen_attr_287, 
coalesce(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST(CAST(((gen_attr_55
 * CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS 
DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_71 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_89 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_107 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_123 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_139 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_155 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_163 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_179 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)), CAST(0 AS DECIMAL(19,6))) AS gen_attr_289, 
coalesce(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST((CAST(CAST(CAST(((gen_attr_63
 * CAST(gen_attr_303 AS DOUBLE)) / CAST(gen_attr_301 AS DOUBLE)) AS 
DECIMAL(18,6)) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_79 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_99 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_115 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_131 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_147 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)) AS DECIMAL(20,6)) + 
CAST(CAST(CAST(((gen_attr_171 * CAST(gen_attr_303 AS DOUBLE)) / 
CAST(gen_attr_301 AS DOUBLE)) AS DECIMAL(18,6)) AS DECIMAL(19,6)) AS 
DECIMAL(20,6))) AS DECIMAL(19,6)), CAST(0 AS DECIMAL(19,6))) AS gen_attr_291, 
gen_attr_304 AS gen_attr_293, gen_attr_305 AS gen_attr_295, gen_attr_306 AS 
gen_attr_297, gen_attr_307 AS gen_attr_299 FROM (SELECT gen_attr_320 AS 
gen_attr_3, gen_attr_321 AS gen_attr_5, gen_attr_322 AS gen_attr_7, 
gen_attr_323 AS gen_attr_9, gen_attr_324 AS gen_attr_11, gen_attr_325 AS 
gen_attr_13, gen_attr_326 AS gen_attr_15, gen_attr_327 AS gen_attr_17, 
gen_attr_328 AS gen_attr_19, gen_attr_329 AS gen_attr_21, gen_attr_330 AS 
gen_attr_23, gen_attr_331 AS gen_attr_25, gen_attr_332 AS gen_attr_27, 
gen_attr_333 AS gen_attr_29, gen_attr_334 AS gen_attr_31, gen_attr_335 AS 
gen_attr_39, gen_attr_336 AS gen_attr_33, gen_attr_337 AS gen_attr_35, 
gen_attr_338 AS gen_attr_37, gen_attr_339 AS gen_attr_41, gen_attr_340 AS 
gen_attr_45, gen_attr_341 AS gen_attr_43, gen_attr_342 AS gen_attr_47, 
gen_attr_343 AS gen_attr_49, gen_attr_344 AS gen_attr_51, gen_attr_345 AS 
gen_attr_53, gen_attr_346 AS gen_attr_55, gen_attr_347 AS gen_attr_57, 
gen_attr_348 AS gen_attr_59, gen_attr_349 AS gen_attr_61, gen_attr_350 AS 
gen_attr_63, gen_attr_351 AS gen_attr_65, gen_attr_352 AS gen_attr_67, 
gen_attr_353 AS gen_attr_69, gen_attr_354 AS gen_attr_71, gen_attr_355 AS 
gen_attr_73, gen_attr_356 AS gen_attr_75, gen_attr_357 AS gen_attr_77, 
gen_attr_358 AS gen_attr_79, gen_attr_359 AS gen_attr_81, gen_attr_360 AS 
gen_attr_83, gen_attr_361 AS gen_attr_87, gen_attr_362 AS gen_attr_85, 
gen_attr_363 AS gen_attr_89, gen_attr_364 AS gen_attr_91, gen_attr_365 AS 
gen_attr_93, gen_attr_366 AS gen_attr_95, gen_attr_367 AS gen_attr_97, 
gen_attr_368 AS gen_attr_99, gen_attr_369 AS gen_attr_101, gen_attr_370 AS 
gen_attr_103, gen_attr_371 AS gen_attr_105, gen_attr_372 AS gen_attr_107, 
gen_attr_373 AS gen_attr_109, gen_attr_374 AS gen_attr_111, gen_attr_375 AS 
gen_attr_113, gen_attr_376 AS gen_attr_115, gen_attr_377 AS gen_attr_117, 
gen_attr_378 AS gen_attr_119, gen_attr_379 AS gen_attr_121, gen_attr_380 AS 
gen_attr_123, gen_attr_381 AS gen_attr_125, gen_attr_382 AS gen_attr_127, 
gen_attr_383 AS gen_attr_129, gen_attr_384 AS gen_attr_131, gen_attr_385 AS 
gen_attr_133, gen_attr_386 AS gen_attr_135, gen_attr_387 AS gen_attr_137, 
gen_attr_388 AS gen_attr_139, gen_attr_389 AS gen_attr_141, gen_attr_390 AS 
gen_attr_143, gen_attr_391 AS gen_attr_145, gen_attr_392 AS gen_attr_147, 
gen_attr_393 AS gen_attr_149, gen_attr_394 AS gen_attr_151, gen_attr_395 AS 
gen_attr_153, gen_attr_396 AS gen_attr_155, gen_attr_397 AS gen_attr_157, 
gen_attr_398 AS gen_attr_159, gen_attr_399 AS gen_attr_161, gen_attr_400 AS 
gen_attr_163, gen_attr_401 AS gen_attr_165, gen_attr_402 AS gen_attr_167, 
gen_attr_403 AS gen_attr_169, gen_attr_404 AS gen_attr_171, gen_attr_405 AS 
gen_attr_173, gen_attr_406 AS gen_attr_175, gen_attr_407 AS gen_attr_177, 
gen_attr_408 AS gen_attr_179, gen_attr_409 AS gen_attr_181, gen_attr_410 AS 
gen_attr_304, gen_attr_411 AS gen_attr_305, gen_attr_412 AS gen_attr_306, 
gen_attr_413 AS gen_attr_307, gen_attr_414 AS gen_attr_1 FROM (SELECT 
adj_type_id AS gen_attr_320, byr_cntry_id AS gen_attr_321, sap_category_id AS 
gen_attr_322, lstg_site_id AS gen_attr_323, lstg_type_code AS gen_attr_324, 
offrd_slng_chnl_grp_id AS gen_attr_325, slr_cntry_id AS gen_attr_326, 
sold_slng_chnl_grp_id AS gen_attr_327, bin_lstg_yn_id AS gen_attr_328, 
bin_sold_yn_id AS gen_attr_329, lstg_curncy_id AS gen_attr_330, blng_curncy_id 
AS gen_attr_331, bid_count AS gen_attr_332, ck_trans_count AS gen_attr_333, 
ended_bid_count AS gen_attr_334, new_lstg_count AS gen_attr_335, 
ended_lstg_count AS gen_attr_336, ended_success_lstg_count AS gen_attr_337, 
item_sold_count AS gen_attr_338, gmv_us_amt AS gen_attr_339, gmv_byr_lc_amt AS 
gen_attr_340, gmv_slr_lc_amt AS gen_attr_341, gmv_lstg_curncy_amt AS 
gen_attr_342, gmv_us_m_amt AS gen_attr_343, rvnu_insrtn_fee_us_amt AS 
gen_attr_344, rvnu_insrtn_fee_lc_amt AS gen_attr_345, rvnu_insrtn_fee_bc_amt AS 
gen_attr_346, rvnu_insrtn_fee_us_m_amt AS gen_attr_347, rvnu_insrtn_crd_us_amt 
AS gen_attr_348, rvnu_insrtn_crd_lc_amt AS gen_attr_349, rvnu_insrtn_crd_bc_amt 
AS gen_attr_350, rvnu_insrtn_crd_us_m_amt AS gen_attr_351, rvnu_fetr_fee_us_amt 
AS gen_attr_352, rvnu_fetr_fee_lc_amt AS gen_attr_353, rvnu_fetr_fee_bc_amt AS 
gen_attr_354, rvnu_fetr_fee_us_m_amt AS gen_attr_355, rvnu_fetr_crd_us_amt AS 
gen_attr_356, rvnu_fetr_crd_lc_amt AS gen_attr_357, rvnu_fetr_crd_bc_amt AS 
gen_attr_358, rvnu_fetr_crd_us_m_amt AS gen_attr_359, rvnu_fv_fee_us_amt AS 
gen_attr_360, rvnu_fv_fee_slr_lc_amt AS gen_attr_361, rvnu_fv_fee_byr_lc_amt AS 
gen_attr_362, rvnu_fv_fee_bc_amt AS gen_attr_363, rvnu_fv_fee_us_m_amt AS 
gen_attr_364, rvnu_fv_crd_us_amt AS gen_attr_365, rvnu_fv_crd_byr_lc_amt AS 
gen_attr_366, rvnu_fv_crd_slr_lc_amt AS gen_attr_367, rvnu_fv_crd_bc_amt AS 
gen_attr_368, rvnu_fv_crd_us_m_amt AS gen_attr_369, rvnu_othr_l_fee_us_amt AS 
gen_attr_370, rvnu_othr_l_fee_lc_amt AS gen_attr_371, rvnu_othr_l_fee_bc_amt AS 
gen_attr_372, rvnu_othr_l_fee_us_m_amt AS gen_attr_373, rvnu_othr_l_crd_us_amt 
AS gen_attr_374, rvnu_othr_l_crd_lc_amt AS gen_attr_375, rvnu_othr_l_crd_bc_amt 
AS gen_attr_376, rvnu_othr_l_crd_us_m_amt AS gen_attr_377, 
rvnu_othr_nl_fee_us_amt AS gen_attr_378, rvnu_othr_nl_fee_lc_amt AS 
gen_attr_379, rvnu_othr_nl_fee_bc_amt AS gen_attr_380, 
rvnu_othr_nl_fee_us_m_amt AS gen_attr_381, rvnu_othr_nl_crd_us_amt AS 
gen_attr_382, rvnu_othr_nl_crd_lc_amt AS gen_attr_383, rvnu_othr_nl_crd_bc_amt 
AS gen_attr_384, rvnu_othr_nl_crd_us_m_amt AS gen_attr_385, 
rvnu_slr_tools_fee_us_amt AS gen_attr_386, rvnu_slr_tools_fee_lc_amt AS 
gen_attr_387, rvnu_slr_tools_fee_bc_amt AS gen_attr_388, 
rvnu_slr_tools_fee_us_m_amt AS gen_attr_389, rvnu_slr_tools_crd_us_amt AS 
gen_attr_390, rvnu_slr_tools_crd_lc_amt AS gen_attr_391, 
rvnu_slr_tools_crd_bc_amt AS gen_attr_392, rvnu_slr_tools_crd_us_m_amt AS 
gen_attr_393, rvnu_unasgnd_us_amt AS gen_attr_394, rvnu_unasgnd_lc_amt AS 
gen_attr_395, rvnu_unasgnd_bc_amt AS gen_attr_396, rvnu_unasgnd_us_m_amt AS 
gen_attr_397, rvnu_ad_fee_us_amt AS gen_attr_398, rvnu_ad_fee_lc_amt AS 
gen_attr_399, rvnu_ad_fee_bc_amt AS gen_attr_400, rvnu_ad_fee_us_m_amt AS 
gen_attr_401, rvnu_ad_crd_us_amt AS gen_attr_402, rvnu_ad_crd_lc_amt AS 
gen_attr_403, rvnu_ad_crd_bc_amt AS gen_attr_404, rvnu_ad_crd_us_m_amt AS 
gen_attr_405, rvnu_othr_ad_fee_us_amt AS gen_attr_406, rvnu_othr_ad_fee_lc_amt 
AS gen_attr_407, rvnu_othr_ad_fee_bc_amt AS gen_attr_408, 
rvnu_othr_ad_fee_us_m_amt AS gen_attr_409, cre_date AS gen_attr_410, cre_user 
AS gen_attr_411, upd_date AS gen_attr_412, upd_user AS gen_attr_413, 
cmn_mtrc_summ_dt AS gen_attr_414 FROM table4) AS gen_subquery_0) AS 
gen_subquery_0 LEFT OUTER JOIN (SELECT gen_attr_415 AS gen_attr_319, 
gen_attr_416 AS gen_attr_300, gen_attr_418 AS gen_attr_417, gen_attr_420 AS 
gen_attr_419, gen_attr_422 AS gen_attr_421, gen_attr_424 AS gen_attr_423 FROM 
(SELECT CURNCY_ID AS gen_attr_415, CURNCY_PLAN_RATE AS gen_attr_416, CRE_DATE 
AS gen_attr_418, CRE_USER AS gen_attr_420, UPD_DATE AS gen_attr_422, UPD_USER 
AS gen_attr_424 FROM table3) AS gen_subquery_1) AS gen_subquery_1 ON 
(CAST(CAST(gen_attr_23 AS DECIMAL(20,0)) AS DECIMAL(20,0)) = CAST(gen_attr_319 
AS DECIMAL(20,0))) LEFT OUTER JOIN (SELECT gen_attr_415 AS gen_attr_318, 
gen_attr_416 AS gen_attr_303, gen_attr_418 AS gen_attr_425, gen_attr_420 AS 
gen_attr_426, gen_attr_422 AS gen_attr_427, gen_attr_424 AS gen_attr_428 FROM 
(SELECT CURNCY_ID AS gen_attr_415, CURNCY_PLAN_RATE AS gen_attr_416, CRE_DATE 
AS gen_attr_418, CRE_USER AS gen_attr_420, UPD_DATE AS gen_attr_422, UPD_USER 
AS gen_attr_424 FROM table3) AS gen_subquery_2) AS gen_subquery_2 ON 
(CAST(CAST(gen_attr_25 AS DECIMAL(20,0)) AS DECIMAL(20,0)) = CAST(gen_attr_318 
AS DECIMAL(20,0))) LEFT OUTER JOIN (SELECT gen_attr_429 AS gen_attr_317, 
gen_attr_431 AS gen_attr_430, gen_attr_433 AS gen_attr_432, gen_attr_435 AS 
gen_attr_434, gen_attr_437 AS gen_attr_436, gen_attr_439 AS gen_attr_438, 
gen_attr_441 AS gen_attr_440, gen_attr_443 AS gen_attr_442, gen_attr_445 AS 
gen_attr_444, gen_attr_446 AS gen_attr_315, gen_attr_448 AS gen_attr_447, 
gen_attr_450 AS gen_attr_449, gen_attr_452 AS gen_attr_451, gen_attr_454 AS 
gen_attr_453, gen_attr_456 AS gen_attr_455, gen_attr_458 AS gen_attr_457, 
gen_attr_460 AS gen_attr_459 FROM (SELECT gen_attr_461 AS gen_attr_429, 
gen_attr_462 AS gen_attr_431, gen_attr_463 AS gen_attr_433, gen_attr_464 AS 
gen_attr_435, gen_attr_465 AS gen_attr_437, gen_attr_466 AS gen_attr_439, 
gen_attr_467 AS gen_attr_441, gen_attr_468 AS gen_attr_443, gen_attr_469 AS 
gen_attr_445, gen_attr_470 AS gen_attr_446, gen_attr_471 AS gen_attr_448, 
gen_attr_472 AS gen_attr_450, gen_attr_473 AS gen_attr_452, gen_attr_474 AS 
gen_attr_454, gen_attr_475 AS gen_attr_456, gen_attr_476 AS gen_attr_458, 
gen_attr_477 AS gen_attr_460 FROM (SELECT gen_attr_478 AS gen_attr_461, 
gen_attr_479 AS gen_attr_462, gen_attr_480 AS gen_attr_463, gen_attr_481 AS 
gen_attr_464, gen_attr_482 AS gen_attr_465, gen_attr_483 AS gen_attr_466, 
gen_attr_484 AS gen_attr_467, gen_attr_485 AS gen_attr_468, gen_attr_486 AS 
gen_attr_469, gen_attr_487 AS gen_attr_470, gen_attr_488 AS gen_attr_471, 
gen_attr_489 AS gen_attr_472, gen_attr_490 AS gen_attr_473, gen_attr_491 AS 
gen_attr_474, gen_attr_492 AS gen_attr_475, gen_attr_493 AS gen_attr_476, 
gen_attr_494 AS gen_attr_477 FROM (SELECT gen_attr_495 AS gen_attr_478, 
gen_attr_496 AS gen_attr_479, gen_attr_497 AS gen_attr_480, gen_attr_498 AS 
gen_attr_481, gen_attr_499 AS gen_attr_482, gen_attr_500 AS gen_attr_483, 
gen_attr_501 AS gen_attr_484, gen_attr_502 AS gen_attr_485, gen_attr_503 AS 
gen_attr_486, gen_attr_504 AS gen_attr_487, gen_attr_505 AS gen_attr_488, 
gen_attr_506 AS gen_attr_489, gen_attr_507 AS gen_attr_490, gen_attr_508 AS 
gen_attr_491, gen_attr_509 AS gen_attr_492, gen_attr_510 AS gen_attr_493, 
gen_attr_511 AS gen_attr_494 FROM (SELECT cntry_id AS gen_attr_495, curncy_id 
AS gen_attr_496, cntry_desc AS gen_attr_497, cntry_code AS gen_attr_498, 
iso_cntry_code AS gen_attr_499, cultural AS gen_attr_500, cntry_busn_unit AS 
gen_attr_501, high_vol_cntry_yn_id AS gen_attr_502, check_sil AS gen_attr_503, 
rev_rollup_id AS gen_attr_504, rev_rollup AS gen_attr_505, prft_cntr_id AS 
gen_attr_506, prft_cntr AS gen_attr_507, cre_date AS gen_attr_508, upd_date AS 
gen_attr_509, cre_user AS gen_attr_510, upd_user AS gen_attr_511 FROM table2) 
AS gen_subquery_3) AS gen_subquery_0) AS gen_subquery_1) AS dw_countries) AS 
gen_subquery_3 ON (CAST(CAST(gen_attr_15 AS DECIMAL(20,0)) AS DECIMAL(20,0)) = 
CAST(gen_attr_317 AS DECIMAL(20,0))) LEFT OUTER JOIN (SELECT gen_attr_512 AS 
gen_attr_316, gen_attr_514 AS gen_attr_513, gen_attr_516 AS gen_attr_515, 
gen_attr_517 AS gen_attr_313, gen_attr_519 AS gen_attr_518, gen_attr_521 AS 
gen_attr_520, gen_attr_523 AS gen_attr_522, gen_attr_525 AS gen_attr_524, 
gen_attr_527 AS gen_attr_526, gen_attr_529 AS gen_attr_528, gen_attr_531 AS 
gen_attr_530, gen_attr_533 AS gen_attr_532, gen_attr_535 AS gen_attr_534, 
gen_attr_537 AS gen_attr_536, gen_attr_539 AS gen_attr_538, gen_attr_541 AS 
gen_attr_540, gen_attr_543 AS gen_attr_542, gen_attr_545 AS gen_attr_544, 
gen_attr_547 AS gen_attr_546, gen_attr_549 AS gen_attr_548, gen_attr_551 AS 
gen_attr_550, gen_attr_553 AS gen_attr_552, gen_attr_555 AS gen_attr_554 FROM 
(SELECT gen_attr_556 AS gen_attr_512, gen_attr_557 AS gen_attr_514, 
gen_attr_558 AS gen_attr_516, gen_attr_559 AS gen_attr_517, gen_attr_560 AS 
gen_attr_519, gen_attr_561 AS gen_attr_521, gen_attr_562 AS gen_attr_523, 
gen_attr_563 AS gen_attr_525, gen_attr_564 AS gen_attr_527, gen_attr_565 AS 
gen_attr_529, gen_attr_566 AS gen_attr_531, gen_attr_567 AS gen_attr_533, 
gen_attr_568 AS gen_attr_535, gen_attr_569 AS gen_attr_537, gen_attr_570 AS 
gen_attr_539, gen_attr_571 AS gen_attr_541, gen_attr_572 AS gen_attr_543, 
gen_attr_573 AS gen_attr_545, gen_attr_574 AS gen_attr_547, gen_attr_575 AS 
gen_attr_549, gen_attr_576 AS gen_attr_551, gen_attr_577 AS gen_attr_553, 
gen_attr_578 AS gen_attr_555 FROM (SELECT gen_attr_579 AS gen_attr_556, 
gen_attr_580 AS gen_attr_557, gen_attr_581 AS gen_attr_558, gen_attr_582 AS 
gen_attr_559, gen_attr_583 AS gen_attr_560, gen_attr_584 AS gen_attr_561, 
gen_attr_585 AS gen_attr_562, gen_attr_586 AS gen_attr_563, gen_attr_587 AS 
gen_attr_564, gen_attr_588 AS gen_attr_565, gen_attr_589 AS gen_attr_566, 
gen_attr_590 AS gen_attr_567, gen_attr_591 AS gen_attr_568, gen_attr_592 AS 
gen_attr_569, gen_attr_593 AS gen_attr_570, gen_attr_594 AS gen_attr_571, 
gen_attr_595 AS gen_attr_572, gen_attr_596 AS gen_attr_573, gen_attr_597 AS 
gen_attr_574, gen_attr_598 AS gen_attr_575, gen_attr_599 AS gen_attr_576, 
gen_attr_600 AS gen_attr_577, gen_attr_601 AS gen_attr_578 FROM (SELECT 
gen_attr_602 AS gen_attr_579, gen_attr_603 AS gen_attr_580, gen_attr_604 AS 
gen_attr_581, gen_attr_605 AS gen_attr_582, gen_attr_606 AS gen_attr_583, 
gen_attr_607 AS gen_attr_584, gen_attr_608 AS gen_attr_585, gen_attr_609 AS 
gen_attr_586, gen_attr_610 AS gen_attr_587, gen_attr_611 AS gen_attr_588, 
gen_attr_612 AS gen_attr_589, gen_attr_613 AS gen_attr_590, gen_attr_614 AS 
gen_attr_591, gen_attr_615 AS gen_attr_592, gen_attr_616 AS gen_attr_593, 
gen_attr_617 AS gen_attr_594, gen_attr_618 AS gen_attr_595, gen_attr_619 AS 
gen_attr_596, gen_attr_620 AS gen_attr_597, gen_attr_621 AS gen_attr_598, 
gen_attr_622 AS gen_attr_599, gen_attr_623 AS gen_attr_600, gen_attr_624 AS 
gen_attr_601 FROM (SELECT rev_rollup_id AS gen_attr_602, rev_rollup AS 
gen_attr_603, rev_rollup_name AS gen_attr_604, curncy_id AS gen_attr_605, 
holding_company AS gen_attr_606, company_code AS gen_attr_607, business_unit AS 
gen_attr_608, dept_code AS gen_attr_609, online AS gen_attr_610, premier AS 
gen_attr_611, partner AS gen_attr_612, real_estate AS gen_attr_613, 
legal_entity_id AS gen_attr_614, src_rev_rollup_id AS gen_attr_615, prft_cntr 
AS gen_attr_616, mngrl_cntry_id AS gen_attr_617, cre_date AS gen_attr_618, 
upd_date AS gen_attr_619, cre_user AS gen_attr_620, upd_user AS gen_attr_621, 
pb_min_succ_bid_count AS gen_attr_622, pb_enbld_yn_id AS gen_attr_623, 
sap_prft_cntr_id AS gen_attr_624 FROM table1) AS gen_subquery_4) AS 
gen_subquery_0) AS gen_subquery_1) AS dw_rev_rollup) AS gen_subquery_4 ON 
(CAST(gen_attr_315 AS INT) = CAST(gen_attr_316 AS INT)) LEFT OUTER JOIN (SELECT 
gen_attr_415 AS gen_attr_314, gen_attr_416 AS gen_attr_301, gen_attr_418 AS 
gen_attr_625, gen_attr_420 AS gen_attr_626, gen_attr_422 AS gen_attr_627, 
gen_attr_424 AS gen_attr_628 FROM (SELECT CURNCY_ID AS gen_attr_415, 
CURNCY_PLAN_RATE AS gen_attr_416, CRE_DATE AS gen_attr_418, CRE_USER AS 
gen_attr_420, UPD_DATE AS gen_attr_422, UPD_USER AS gen_attr_424 FROM table3) 
AS gen_subquery_5) AS gen_subquery_5 ON (CAST(CAST(gen_attr_313 AS 
DECIMAL(20,0)) AS DECIMAL(20,0)) = CAST(gen_attr_314 AS DECIMAL(20,0))) LEFT 
OUTER JOIN (SELECT gen_attr_629 AS gen_attr_312, gen_attr_631 AS gen_attr_630, 
gen_attr_633 AS gen_attr_632, gen_attr_635 AS gen_attr_634, gen_attr_637 AS 
gen_attr_636, gen_attr_639 AS gen_attr_638, gen_attr_641 AS gen_attr_640, 
gen_attr_643 AS gen_attr_642, gen_attr_645 AS gen_attr_644, gen_attr_646 AS 
gen_attr_310, gen_attr_648 AS gen_attr_647, gen_attr_650 AS gen_attr_649, 
gen_attr_652 AS gen_attr_651, gen_attr_654 AS gen_attr_653, gen_attr_656 AS 
gen_attr_655, gen_attr_658 AS gen_attr_657, gen_attr_660 AS gen_attr_659 FROM 
(SELECT gen_attr_661 AS gen_attr_629, gen_attr_662 AS gen_attr_631, 
gen_attr_663 AS gen_attr_633, gen_attr_664 AS gen_attr_635, gen_attr_665 AS 
gen_attr_637, gen_attr_666 AS gen_attr_639, gen_attr_667 AS gen_attr_641, 
gen_attr_668 AS gen_attr_643, gen_attr_669 AS gen_attr_645, gen_attr_670 AS 
gen_attr_646, gen_attr_671 AS gen_attr_648, gen_attr_672 AS gen_attr_650, 
gen_attr_673 AS gen_attr_652, gen_attr_674 AS gen_attr_654, gen_attr_675 AS 
gen_attr_656, gen_attr_676 AS gen_attr_658, gen_attr_677 AS gen_attr_660 FROM 
(SELECT gen_attr_678 AS gen_attr_661, gen_attr_679 AS gen_attr_662, 
gen_attr_680 AS gen_attr_663, gen_attr_681 AS gen_attr_664, gen_attr_682 AS 
gen_attr_665, gen_attr_683 AS gen_attr_666, gen_attr_684 AS gen_attr_667, 
gen_attr_685 AS gen_attr_668, gen_attr_686 AS gen_attr_669, gen_attr_687 AS 
gen_attr_670, gen_attr_688 AS gen_attr_671, gen_attr_689 AS gen_attr_672, 
gen_attr_690 AS gen_attr_673, gen_attr_691 AS gen_attr_674, gen_attr_692 AS 
gen_attr_675, gen_attr_693 AS gen_attr_676, gen_attr_694 AS gen_attr_677 FROM 
(SELECT gen_attr_495 AS gen_attr_678, gen_attr_496 AS gen_attr_679, 
gen_attr_497 AS gen_attr_680, gen_attr_498 AS gen_attr_681, gen_attr_499 AS 
gen_attr_682, gen_attr_500 AS gen_attr_683, gen_attr_501 AS gen_attr_684, 
gen_attr_502 AS gen_attr_685, gen_attr_503 AS gen_attr_686, gen_attr_504 AS 
gen_attr_687, gen_attr_505 AS gen_attr_688, gen_attr_506 AS gen_attr_689, 
gen_attr_507 AS gen_attr_690, gen_attr_508 AS gen_attr_691, gen_attr_509 AS 
gen_attr_692, gen_attr_510 AS gen_attr_693, gen_attr_511 AS gen_attr_694 FROM 
(SELECT cntry_id AS gen_attr_495, curncy_id AS gen_attr_496, cntry_desc AS 
gen_attr_497, cntry_code AS gen_attr_498, iso_cntry_code AS gen_attr_499, 
cultural AS gen_attr_500, cntry_busn_unit AS gen_attr_501, high_vol_cntry_yn_id 
AS gen_attr_502, check_sil AS gen_attr_503, rev_rollup_id AS gen_attr_504, 
rev_rollup AS gen_attr_505, prft_cntr_id AS gen_attr_506, prft_cntr AS 
gen_attr_507, cre_date AS gen_attr_508, upd_date AS gen_attr_509, cre_user AS 
gen_attr_510, upd_user AS gen_attr_511 FROM table2) AS gen_subquery_6) AS 
gen_subquery_0) AS gen_subquery_1) AS dw_countries) AS gen_subquery_6 ON 
(CAST(CAST(gen_attr_5 AS DECIMAL(20,0)) AS DECIMAL(20,0)) = CAST(gen_attr_312 
AS DECIMAL(20,0))) LEFT OUTER JOIN (SELECT gen_attr_695 AS gen_attr_311, 
gen_attr_697 AS gen_attr_696, gen_attr_699 AS gen_attr_698, gen_attr_700 AS 
gen_attr_308, gen_attr_702 AS gen_attr_701, gen_attr_704 AS gen_attr_703, 
gen_attr_706 AS gen_attr_705, gen_attr_708 AS gen_attr_707, gen_attr_710 AS 
gen_attr_709, gen_attr_712 AS gen_attr_711, gen_attr_714 AS gen_attr_713, 
gen_attr_716 AS gen_attr_715, gen_attr_718 AS gen_attr_717, gen_attr_720 AS 
gen_attr_719, gen_attr_722 AS gen_attr_721, gen_attr_724 AS gen_attr_723, 
gen_attr_726 AS gen_attr_725, gen_attr_728 AS gen_attr_727, gen_attr_730 AS 
gen_attr_729, gen_attr_732 AS gen_attr_731, gen_attr_734 AS gen_attr_733, 
gen_attr_736 AS gen_attr_735, gen_attr_738 AS gen_attr_737 FROM (SELECT 
gen_attr_739 AS gen_attr_695, gen_attr_740 AS gen_attr_697, gen_attr_741 AS 
gen_attr_699, gen_attr_742 AS gen_attr_700, gen_attr_743 AS gen_attr_702, 
gen_attr_744 AS gen_attr_704, gen_attr_745 AS gen_attr_706, gen_attr_746 AS 
gen_attr_708, gen_attr_747 AS gen_attr_710, gen_attr_748 AS gen_attr_712, 
gen_attr_749 AS gen_attr_714, gen_attr_750 AS gen_attr_716, gen_attr_751 AS 
gen_attr_718, gen_attr_752 AS gen_attr_720, gen_attr_753 AS gen_attr_722, 
gen_attr_754 AS gen_attr_724, gen_attr_755 AS gen_attr_726, gen_attr_756 AS 
gen_attr_728, gen_attr_757 AS gen_attr_730, gen_attr_758 AS gen_attr_732, 
gen_attr_759 AS gen_attr_734, gen_attr_760 AS gen_attr_736, gen_attr_761 AS 
gen_attr_738 FROM (SELECT gen_attr_762 AS gen_attr_739, gen_attr_763 AS 
gen_attr_740, gen_attr_764 AS gen_attr_741, gen_attr_765 AS gen_attr_742, 
gen_attr_766 AS gen_attr_743, gen_attr_767 AS gen_attr_744, gen_attr_768 AS 
gen_attr_745, gen_attr_769 AS gen_attr_746, gen_attr_770 AS gen_attr_747, 
gen_attr_771 AS gen_attr_748, gen_attr_772 AS gen_attr_749, gen_attr_773 AS 
gen_attr_750, gen_attr_774 AS gen_attr_751, gen_attr_775 AS gen_attr_752, 
gen_attr_776 AS gen_attr_753, gen_attr_777 AS gen_attr_754, gen_attr_778 AS 
gen_attr_755, gen_attr_779 AS gen_attr_756, gen_attr_780 AS gen_attr_757, 
gen_attr_781 AS gen_attr_758, gen_attr_782 AS gen_attr_759, gen_attr_783 AS 
gen_attr_760, gen_attr_784 AS gen_attr_761 FROM (SELECT gen_attr_602 AS 
gen_attr_762, gen_attr_603 AS gen_attr_763, gen_attr_604 AS gen_attr_764, 
gen_attr_605 AS gen_attr_765, gen_attr_606 AS gen_attr_766, gen_attr_607 AS 
gen_attr_767, gen_attr_608 AS gen_attr_768, gen_attr_609 AS gen_attr_769, 
gen_attr_610 AS gen_attr_770, gen_attr_611 AS gen_attr_771, gen_attr_612 AS 
gen_attr_772, gen_attr_613 AS gen_attr_773, gen_attr_614 AS gen_attr_774, 
gen_attr_615 AS gen_attr_775, gen_attr_616 AS gen_attr_776, gen_attr_617 AS 
gen_attr_777, gen_attr_618 AS gen_attr_778, gen_attr_619 AS gen_attr_779, 
gen_attr_620 AS gen_attr_780, gen_attr_621 AS gen_attr_781, gen_attr_622 AS 
gen_attr_782, gen_attr_623 AS gen_attr_783, gen_attr_624 AS gen_attr_784 FROM 
(SELECT rev_rollup_id AS gen_attr_602, rev_rollup AS gen_attr_603, 
rev_rollup_name AS gen_attr_604, curncy_id AS gen_attr_605, holding_company AS 
gen_attr_606, company_code AS gen_attr_607, business_unit AS gen_attr_608, 
dept_code AS gen_attr_609, online AS gen_attr_610, premier AS gen_attr_611, 
partner AS gen_attr_612, real_estate AS gen_attr_613, legal_entity_id AS 
gen_attr_614, src_rev_rollup_id AS gen_attr_615, prft_cntr AS gen_attr_616, 
mngrl_cntry_id AS gen_attr_617, cre_date AS gen_attr_618, upd_date AS 
gen_attr_619, cre_user AS gen_attr_620, upd_user AS gen_attr_621, 
pb_min_succ_bid_count AS gen_attr_622, pb_enbld_yn_id AS gen_attr_623, 
sap_prft_cntr_id AS gen_attr_624 FROM table1) AS gen_subquery_7) AS 
gen_subquery_0) AS gen_subquery_1) AS dw_rev_rollup) AS gen_subquery_7 ON 
(CAST(gen_attr_310 AS INT) = CAST(gen_attr_311 AS INT)) LEFT OUTER JOIN (SELECT 
gen_attr_415 AS gen_attr_309, gen_attr_416 AS gen_attr_302, gen_attr_418 AS 
gen_attr_785, gen_attr_420 AS gen_attr_786, gen_attr_422 AS gen_attr_787, 
gen_attr_424 AS gen_attr_788 FROM (SELECT CURNCY_ID AS gen_attr_415, 
CURNCY_PLAN_RATE AS gen_attr_416, CRE_DATE AS gen_attr_418, CRE_USER AS 
gen_attr_420, UPD_DATE AS gen_attr_422, UPD_USER AS gen_attr_424 FROM table3) 
AS gen_subquery_8) AS gen_subquery_8 ON (CAST(CAST(gen_attr_308 AS 
DECIMAL(20,0)) AS DECIMAL(20,0)) = CAST(gen_attr_309 AS DECIMAL(20,0)))) AS SD) 
AS gen_subquery_9

{code}

{code:scala}
org.apache.spark.sql.catalyst.rules.RuleExecutor.resetMetrics()
spark.sql("""

SELECT
        g2.cmn_mtrc_summ_dt,
        g2.lstg_site_id,
        g2.lstg_type_code,
        CASE WHEN g2.slr_cntry_id = g2.byr_cntry_id THEN 0 ELSE 1 END AS 
cbt_bit,
        SUM(COALESCE(g2.bid_count,0)) AS bids,
        SUM(COALESCE(g2.ck_trans_count,0)) AS ck_txns,
        SUM(COALESCE(g2.ended_bid_count,0)) AS ended_bids,
        SUM(COALESCE(g2.ended_lstg_count,0)) AS ended_listings,
        SUM(COALESCE(g2.ended_success_lstg_count,0)) AS ended_succ_listings,
        SUM(COALESCE(g2.item_sold_count,0)) AS items_sold,
        SUM(COALESCE(g2.new_lstg_count,0)) AS new_listings,
        SUM(COALESCE(g2.gmv_us_amt,0)) AS gmv_usd,
        SUM(COALESCE(g2.rvnu_insrtn_fee_us_amt,0) + 
COALESCE(g2.rvnu_insrtn_crd_us_amt,0)) AS insertion_rev_usd,
        SUM(COALESCE(g2.rvnu_fetr_fee_us_amt,0) + 
COALESCE(g2.rvnu_fetr_crd_us_amt,0)) AS feature_rev_usd,
        SUM(COALESCE(g2.rvnu_fv_fee_us_amt,0) + 
COALESCE(g2.rvnu_fv_crd_us_amt,0)) AS fvf_rev_usd,
        SUM(COALESCE(g2.rvnu_othr_l_fee_us_amt,0) + 
COALESCE(g2.rvnu_othr_l_crd_us_amt,0)) AS other_listing_rev_usd,
        SUM(COALESCE(g2.rvnu_othr_nl_fee_us_amt,0) + 
COALESCE(g2.rvnu_othr_nl_crd_us_amt,0)) AS other_nonlisting_rev_usd,
        SUM(COALESCE(g2.rvnu_slr_tools_fee_us_amt,0) + 
COALESCE(g2.rvnu_slr_tools_crd_us_amt,0)) AS selling_tools_rev_usd,
        SUM(COALESCE(g2.rvnu_unasgnd_us_amt,0)) AS unassigned_rev_usd,
        SUM(COALESCE(g2.rvnu_transaction_us_amt,0) + 
COALESCE(g2.rvnu_transaction_crd_us_amt,0)) AS transaction_rev_usd,
        SUM(COALESCE(g2.rvnu_total_us_amt,0) + 
COALESCE(g2.rvnu_total_crd_us_amt,0)) AS total_rev_usd
FROM
        viewe1 g2
WHERE
        g2.cmn_mtrc_summ_dt BETWEEN '2019-07-01' AND '2019-07-01'
GROUP BY
        1,2,3,4

""").explain
println(org.apache.spark.sql.catalyst.rules.RuleExecutor.dumpTimeSpent())

{code}


> Improve ResolveRelations and ResolveTables performance
> ------------------------------------------------------
>
>                 Key: SPARK-29947
>                 URL: https://issues.apache.org/jira/browse/SPARK-29947
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Yuming Wang
>            Priority: Major
>
> For SQL in SPARK-29606.  The physical plan in:
> {noformat}
> == Physical Plan ==
> *(12) HashAggregate(keys=[cmn_mtrc_summ_dt#21, rev_rollup#1279, CASE WHEN 
> (rev_rollup#1319 = rev_rollup#1279) THEN 0 ELSE 1 END#1366, CASE WHEN 
> cast(sap_category_id#24 as decimal(10,0)) IN (5,7,23,41) THEN 0 ELSE 1 
> END#1367], functions=[sum(coalesce(bid_count#34, 0)), 
> sum(coalesce(ck_trans_count#35, 0)), sum(coalesce(ended_bid_count#36, 0)), 
> sum(coalesce(ended_lstg_count#37, 0)), 
> sum(coalesce(ended_success_lstg_count#38, 0)), 
> sum(coalesce(item_sold_count#39, 0)), sum(coalesce(new_lstg_count#40, 0)), 
> sum(coalesce(gmv_us_amt#41, 0.00)), sum(coalesce(gmv_slr_lc_amt#42, 0.00)), 
> sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_insrtn_fee_us_amt#46, 
> 0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_insrtn_crd_us_amt#50, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_fetr_fee_us_amt#54, 
> 0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_fetr_crd_us_amt#58, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_fv_fee_us_amt#62, 
> 0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_fv_crd_us_amt#67, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_othr_l_fee_us_amt#72, 
> 0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_othr_l_crd_us_amt#76, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_othr_nl_fee_us_amt#80,
>  0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_othr_nl_crd_us_amt#84, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_slr_tools_fee_us_amt#88,
>  0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_slr_tools_crd_us_amt#92, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> sum(coalesce(rvnu_unasgnd_us_amt#96, 0.000000)), 
> sum((coalesce(rvnu_transaction_us_amt#112, 0.0) + 
> coalesce(rvnu_transaction_crd_us_amt#115, 0.0))), 
> sum((coalesce(rvnu_total_us_amt#118, 0.0) + 
> coalesce(rvnu_total_crd_us_amt#121, 0.0)))])
> +- Exchange hashpartitioning(cmn_mtrc_summ_dt#21, rev_rollup#1279, CASE WHEN 
> (rev_rollup#1319 = rev_rollup#1279) THEN 0 ELSE 1 END#1366, CASE WHEN 
> cast(sap_category_id#24 as decimal(10,0)) IN (5,7,23,41) THEN 0 ELSE 1 
> END#1367, 200), true, [id=#403]
>    +- *(11) HashAggregate(keys=[cmn_mtrc_summ_dt#21, rev_rollup#1279, CASE 
> WHEN (rev_rollup#1319 = rev_rollup#1279) THEN 0 ELSE 1 END AS CASE WHEN 
> (rev_rollup#1319 = rev_rollup#1279) THEN 0 ELSE 1 END#1366, CASE WHEN 
> cast(sap_category_id#24 as decimal(10,0)) IN (5,7,23,41) THEN 0 ELSE 1 END AS 
> CASE WHEN cast(sap_category_id#24 as decimal(10,0)) IN (5,7,23,41) THEN 0 
> ELSE 1 END#1367], functions=[partial_sum(coalesce(bid_count#34, 0)), 
> partial_sum(coalesce(ck_trans_count#35, 0)), 
> partial_sum(coalesce(ended_bid_count#36, 0)), 
> partial_sum(coalesce(ended_lstg_count#37, 0)), 
> partial_sum(coalesce(ended_success_lstg_count#38, 0)), 
> partial_sum(coalesce(item_sold_count#39, 0)), 
> partial_sum(coalesce(new_lstg_count#40, 0)), 
> partial_sum(coalesce(gmv_us_amt#41, 0.00)), 
> partial_sum(coalesce(gmv_slr_lc_amt#42, 0.00)), 
> partial_sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_insrtn_fee_us_amt#46,
>  0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_insrtn_crd_us_amt#50, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> partial_sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_fetr_fee_us_amt#54,
>  0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_fetr_crd_us_amt#58, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> partial_sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_fv_fee_us_amt#62,
>  0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_fv_crd_us_amt#67, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> partial_sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_othr_l_fee_us_amt#72,
>  0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_othr_l_crd_us_amt#76, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> partial_sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_othr_nl_fee_us_amt#80,
>  0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_othr_nl_crd_us_amt#84, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> partial_sum(CheckOverflow((promote_precision(cast(coalesce(rvnu_slr_tools_fee_us_amt#88,
>  0.000000) as decimal(19,6))) + 
> promote_precision(cast(coalesce(rvnu_slr_tools_crd_us_amt#92, 0.000000) as 
> decimal(19,6)))), DecimalType(19,6), true)), 
> partial_sum(coalesce(rvnu_unasgnd_us_amt#96, 0.000000)), 
> partial_sum((coalesce(rvnu_transaction_us_amt#112, 0.0) + 
> coalesce(rvnu_transaction_crd_us_amt#115, 0.0))), 
> partial_sum((coalesce(rvnu_total_us_amt#118, 0.0) + 
> coalesce(rvnu_total_crd_us_amt#121, 0.0)))])
>       +- *(11) Project [cmn_mtrc_summ_dt#21, sap_category_id#24, 
> bid_count#34, ck_trans_count#35, ended_bid_count#36, ended_lstg_count#37, 
> ended_success_lstg_count#38, item_sold_count#39, new_lstg_count#40, 
> gmv_us_amt#41, gmv_slr_lc_amt#42, rvnu_insrtn_fee_us_amt#46, 
> rvnu_insrtn_crd_us_amt#50, rvnu_fetr_fee_us_amt#54, rvnu_fetr_crd_us_amt#58, 
> rvnu_fv_fee_us_amt#62, rvnu_fv_crd_us_amt#67, rvnu_othr_l_fee_us_amt#72, 
> rvnu_othr_l_crd_us_amt#76, rvnu_othr_nl_fee_us_amt#80, 
> rvnu_othr_nl_crd_us_amt#84, rvnu_slr_tools_fee_us_amt#88, 
> rvnu_slr_tools_crd_us_amt#92, rvnu_unasgnd_us_amt#96, ... 6 more fields]
>          +- *(11) BroadcastHashJoin [byr_cntry_id#23], [cntry_id#1309], 
> LeftOuter, BuildRight
>             :- *(11) Project [cmn_mtrc_summ_dt#21, byr_cntry_id#23, 
> sap_category_id#24, bid_count#34, ck_trans_count#35, ended_bid_count#36, 
> ended_lstg_count#37, ended_success_lstg_count#38, item_sold_count#39, 
> new_lstg_count#40, gmv_us_amt#41, gmv_slr_lc_amt#42, 
> rvnu_insrtn_fee_us_amt#46, rvnu_insrtn_crd_us_amt#50, 
> rvnu_fetr_fee_us_amt#54, rvnu_fetr_crd_us_amt#58, rvnu_fv_fee_us_amt#62, 
> rvnu_fv_crd_us_amt#67, rvnu_othr_l_fee_us_amt#72, rvnu_othr_l_crd_us_amt#76, 
> rvnu_othr_nl_fee_us_amt#80, rvnu_othr_nl_crd_us_amt#84, 
> rvnu_slr_tools_fee_us_amt#88, rvnu_slr_tools_crd_us_amt#92, ... 6 more fields]
>             :  +- *(11) BroadcastHashJoin [slr_cntry_id#28], [cntry_id#1269], 
> LeftOuter, BuildRight
>             :     :- *(11) Project [gen_attr_1#360 AS cmn_mtrc_summ_dt#21, 
> gen_attr_5#267 AS byr_cntry_id#23, gen_attr_7#268 AS sap_category_id#24, 
> gen_attr_15#272 AS slr_cntry_id#28, gen_attr_27#278 AS bid_count#34, 
> gen_attr_29#279 AS ck_trans_count#35, gen_attr_31#280 AS ended_bid_count#36, 
> gen_attr_33#282 AS ended_lstg_count#37, gen_attr_35#283 AS 
> ended_success_lstg_count#38, gen_attr_37#284 AS item_sold_count#39, 
> gen_attr_39#281 AS new_lstg_count#40, gen_attr_41#285 AS gmv_us_amt#41, 
> gen_attr_43#287 AS gmv_slr_lc_amt#42, gen_attr_51#290 AS 
> rvnu_insrtn_fee_us_amt#46, gen_attr_59#294 AS rvnu_insrtn_crd_us_amt#50, 
> gen_attr_67#298 AS rvnu_fetr_fee_us_amt#54, gen_attr_75#302 AS 
> rvnu_fetr_crd_us_amt#58, gen_attr_83#306 AS rvnu_fv_fee_us_amt#62, 
> gen_attr_93#311 AS rvnu_fv_crd_us_amt#67, gen_attr_103#316 AS 
> rvnu_othr_l_fee_us_amt#72, gen_attr_111#320 AS rvnu_othr_l_crd_us_amt#76, 
> gen_attr_119#324 AS rvnu_othr_nl_fee_us_amt#80, gen_attr_127#328 AS 
> rvnu_othr_nl_crd_us_amt#84, gen_attr_135#332 AS rvnu_slr_tools_fee_us_amt#88, 
> ... 6 more fields]
>             :     :  +- *(11) BroadcastHashJoin [cast(gen_attr_308#777 as 
> decimal(20,0))], [cast(gen_attr_309#803 as decimal(20,0))], LeftOuter, 
> BuildRight
>             :     :     :- *(11) Project [gen_attr_5#267, gen_attr_7#268, 
> gen_attr_15#272, gen_attr_27#278, gen_attr_29#279, gen_attr_31#280, 
> gen_attr_39#281, gen_attr_33#282, gen_attr_35#283, gen_attr_37#284, 
> gen_attr_41#285, gen_attr_43#287, gen_attr_51#290, gen_attr_59#294, 
> gen_attr_67#298, gen_attr_75#302, gen_attr_83#306, gen_attr_93#311, 
> gen_attr_103#316, gen_attr_111#320, gen_attr_119#324, gen_attr_127#328, 
> gen_attr_135#332, gen_attr_143#336, ... 6 more fields]
>             :     :     :  +- *(11) BroadcastHashJoin [cast(gen_attr_310#674 
> as int)], [cast(gen_attr_311#774 as int)], LeftOuter, BuildRight
>             :     :     :     :- *(11) Project [gen_attr_5#267, 
> gen_attr_7#268, gen_attr_15#272, gen_attr_27#278, gen_attr_29#279, 
> gen_attr_31#280, gen_attr_39#281, gen_attr_33#282, gen_attr_35#283, 
> gen_attr_37#284, gen_attr_41#285, gen_attr_43#287, gen_attr_51#290, 
> gen_attr_59#294, gen_attr_67#298, gen_attr_75#302, gen_attr_83#306, 
> gen_attr_93#311, gen_attr_103#316, gen_attr_111#320, gen_attr_119#324, 
> gen_attr_127#328, gen_attr_135#332, gen_attr_143#336, ... 6 more fields]
>             :     :     :     :  +- *(11) BroadcastHashJoin 
> [cast(gen_attr_5#267 as decimal(20,0))], [cast(gen_attr_312#665 as 
> decimal(20,0))], LeftOuter, BuildRight
>             :     :     :     :     :- *(11) Project [gen_attr_5#267, 
> gen_attr_7#268, gen_attr_15#272, gen_attr_27#278, gen_attr_29#279, 
> gen_attr_31#280, gen_attr_39#281, gen_attr_33#282, gen_attr_35#283, 
> gen_attr_37#284, gen_attr_41#285, gen_attr_43#287, gen_attr_51#290, 
> gen_attr_59#294, gen_attr_67#298, gen_attr_75#302, gen_attr_83#306, 
> gen_attr_93#311, gen_attr_103#316, gen_attr_111#320, gen_attr_119#324, 
> gen_attr_127#328, gen_attr_135#332, gen_attr_143#336, ... 5 more fields]
>             :     :     :     :     :  +- *(11) BroadcastHashJoin 
> [cast(gen_attr_313#565 as decimal(20,0))], [cast(gen_attr_314#591 as 
> decimal(20,0))], LeftOuter, BuildRight
>             :     :     :     :     :     :- *(11) Project [gen_attr_5#267, 
> gen_attr_7#268, gen_attr_15#272, gen_attr_27#278, gen_attr_29#279, 
> gen_attr_31#280, gen_attr_39#281, gen_attr_33#282, gen_attr_35#283, 
> gen_attr_37#284, gen_attr_41#285, gen_attr_43#287, gen_attr_51#290, 
> gen_attr_59#294, gen_attr_67#298, gen_attr_75#302, gen_attr_83#306, 
> gen_attr_93#311, gen_attr_103#316, gen_attr_111#320, gen_attr_119#324, 
> gen_attr_127#328, gen_attr_135#332, gen_attr_143#336, ... 6 more fields]
>             :     :     :     :     :     :  +- *(11) BroadcastHashJoin 
> [cast(gen_attr_315#462 as int)], [cast(gen_attr_316#562 as int)], LeftOuter, 
> BuildRight
>             :     :     :     :     :     :     :- *(11) Project 
> [gen_attr_5#267, gen_attr_7#268, gen_attr_15#272, gen_attr_27#278, 
> gen_attr_29#279, gen_attr_31#280, gen_attr_39#281, gen_attr_33#282, 
> gen_attr_35#283, gen_attr_37#284, gen_attr_41#285, gen_attr_43#287, 
> gen_attr_51#290, gen_attr_59#294, gen_attr_67#298, gen_attr_75#302, 
> gen_attr_83#306, gen_attr_93#311, gen_attr_103#316, gen_attr_111#320, 
> gen_attr_119#324, gen_attr_127#328, gen_attr_135#332, gen_attr_143#336, ... 6 
> more fields]
>             :     :     :     :     :     :     :  +- *(11) BroadcastHashJoin 
> [cast(gen_attr_15#272 as decimal(20,0))], [cast(gen_attr_317#453 as 
> decimal(20,0))], LeftOuter, BuildRight
>             :     :     :     :     :     :     :     :- *(11) Project 
> [gen_attr_5#267, gen_attr_7#268, gen_attr_15#272, gen_attr_27#278, 
> gen_attr_29#279, gen_attr_31#280, gen_attr_39#281, gen_attr_33#282, 
> gen_attr_35#283, gen_attr_37#284, gen_attr_41#285, gen_attr_43#287, 
> gen_attr_51#290, gen_attr_59#294, gen_attr_67#298, gen_attr_75#302, 
> gen_attr_83#306, gen_attr_93#311, gen_attr_103#316, gen_attr_111#320, 
> gen_attr_119#324, gen_attr_127#328, gen_attr_135#332, gen_attr_143#336, ... 5 
> more fields]
>             :     :     :     :     :     :     :     :  +- *(11) 
> BroadcastHashJoin [cast(gen_attr_25#277 as decimal(20,0))], 
> [cast(gen_attr_318#379 as decimal(20,0))], LeftOuter, BuildRight
>             :     :     :     :     :     :     :     :     :- *(11) Project 
> [gen_attr_5#267, gen_attr_7#268, gen_attr_15#272, gen_attr_25#277, 
> gen_attr_27#278, gen_attr_29#279, gen_attr_31#280, gen_attr_39#281, 
> gen_attr_33#282, gen_attr_35#283, gen_attr_37#284, gen_attr_41#285, 
> gen_attr_43#287, gen_attr_51#290, gen_attr_59#294, gen_attr_67#298, 
> gen_attr_75#302, gen_attr_83#306, gen_attr_93#311, gen_attr_103#316, 
> gen_attr_111#320, gen_attr_119#324, gen_attr_127#328, gen_attr_135#332, ... 6 
> more fields]
>             :     :     :     :     :     :     :     :     :  +- *(11) 
> BroadcastHashJoin [cast(gen_attr_23#276 as decimal(20,0))], 
> [cast(gen_attr_319#367 as decimal(20,0))], LeftOuter, BuildRight
>             :     :     :     :     :     :     :     :     :     :- *(11) 
> Project [byr_cntry_id#1169 AS gen_attr_5#267, sap_category_id#1170 AS 
> gen_attr_7#268, slr_cntry_id#1174 AS gen_attr_15#272, lstg_curncy_id#1178 AS 
> gen_attr_23#276, blng_curncy_id#1179 AS gen_attr_25#277, bid_count#1180 AS 
> gen_attr_27#278, ck_trans_count#1181 AS gen_attr_29#279, ended_bid_count#1182 
> AS gen_attr_31#280, new_lstg_count#1183 AS gen_attr_39#281, 
> ended_lstg_count#1184 AS gen_attr_33#282, ended_success_lstg_count#1185 AS 
> gen_attr_35#283, item_sold_count#1186 AS gen_attr_37#284, gmv_us_amt#1187 AS 
> gen_attr_41#285, gmv_slr_lc_amt#1189 AS gen_attr_43#287, 
> rvnu_insrtn_fee_us_amt#1192 AS gen_attr_51#290, rvnu_insrtn_crd_us_amt#1196 
> AS gen_attr_59#294, rvnu_fetr_fee_us_amt#1200 AS gen_attr_67#298, 
> rvnu_fetr_crd_us_amt#1204 AS gen_attr_75#302, rvnu_fv_fee_us_amt#1208 AS 
> gen_attr_83#306, rvnu_fv_crd_us_amt#1213 AS gen_attr_93#311, 
> rvnu_othr_l_fee_us_amt#1218 AS gen_attr_103#316, rvnu_othr_l_crd_us_amt#1222 
> AS gen_attr_111#320, rvnu_othr_nl_fee_us_amt#1226 AS gen_attr_119#324, 
> rvnu_othr_nl_crd_us_amt#1230 AS gen_attr_127#328, ... 7 more fields]
>             :     :     :     :     :     :     :     :     :     :  +- *(11) 
> ColumnarToRow
>             :     :     :     :     :     :     :     :     :     :     +- 
> FileScan parquet 
> default.big_table1[byr_cntry_id#1169,sap_category_id#1170,slr_cntry_id#1174,lstg_curncy_id#1178,blng_curncy_id#1179,bid_count#1180,ck_trans_count#1181,ended_bid_count#1182,new_lstg_count#1183,ended_lstg_count#1184,ended_success_lstg_count#1185,item_sold_count#1186,gmv_us_amt#1187,gmv_slr_lc_amt#1189,rvnu_insrtn_fee_us_amt#1192,rvnu_insrtn_crd_us_amt#1196,rvnu_fetr_fee_us_amt#1200,rvnu_fetr_crd_us_amt#1204,rvnu_fv_fee_us_amt#1208,rvnu_fv_crd_us_amt#1213,rvnu_othr_l_fee_us_amt#1218,rvnu_othr_l_crd_us_amt#1222,rvnu_othr_nl_fee_us_amt#1226,rvnu_othr_nl_crd_us_amt#1230,...
>  7 more fields] Batched: true, DataFilters: [], Format: Parquet, Location: 
> PrunedInMemoryFileIndex[], PartitionFilters: 
> [isnotnull(cmn_mtrc_summ_dt#1262), (cmn_mtrc_summ_dt#1262 >= 18078), 
> (cmn_mtrc_summ_dt#1262 <= 18..., PushedFilters: [], ReadSchema: 
> struct<byr_cntry_id:decimal(4,0),sap_category_id:decimal(9,0),slr_cntry_id:decimal(4,0),lstg_curn...
>             :     :     :     :     :     :     :     :     :     +- 
> BroadcastExchange HashedRelationBroadcastMode(List(cast(input[0, 
> decimal(9,0), true] as decimal(20,0)))), [id=#288]
>             :     :     :     :     :     :     :     :     :        +- *(1) 
> Project [CURNCY_ID#1263 AS gen_attr_319#367]
>             :     :     :     :     :     :     :     :     :           +- 
> *(1) Filter isnotnull(CURNCY_ID#1263)
>             :     :     :     :     :     :     :     :     :              +- 
> *(1) ColumnarToRow
>             :     :     :     :     :     :     :     :     :                 
> +- FileScan parquet default.small_table1[CURNCY_ID#1263] Batched: true, 
> DataFilters: [isnotnull(CURNCY_ID#1263)], Format: Parquet, Location: 
> InMemoryFileIndex[file:/user/hive/warehouse/small_table1], PartitionFilters: 
> [], PushedFilters: [IsNotNull(CURNCY_ID)], ReadSchema: 
> struct<CURNCY_ID:decimal(9,0)>, SelectedBucketsCount: 1 out of 1
>             :     :     :     :     :     :     :     :     +- 
> BroadcastExchange HashedRelationBroadcastMode(List(cast(input[0, 
> decimal(9,0), true] as decimal(20,0)))), [id=#297]
>             :     :     :     :     :     :     :     :        +- *(2) 
> Project [CURNCY_ID#1263 AS gen_attr_318#379]
>             :     :     :     :     :     :     :     :           +- *(2) 
> Filter isnotnull(CURNCY_ID#1263)
>             :     :     :     :     :     :     :     :              +- *(2) 
> ColumnarToRow
>             :     :     :     :     :     :     :     :                 +- 
> FileScan parquet default.small_table1[CURNCY_ID#1263] Batched: true, 
> DataFilters: [isnotnull(CURNCY_ID#1263)], Format: Parquet, Location: 
> InMemoryFileIndex[file:/user/hive/warehouse/small_table1], PartitionFilters: 
> [], PushedFilters: [IsNotNull(CURNCY_ID)], ReadSchema: 
> struct<CURNCY_ID:decimal(9,0)>, SelectedBucketsCount: 1 out of 1
>             :     :     :     :     :     :     :     +- BroadcastExchange 
> HashedRelationBroadcastMode(List(cast(input[0, decimal(4,0), true] as 
> decimal(20,0)))), [id=#306]
>             :     :     :     :     :     :     :        +- *(3) Project 
> [cntry_id#1269 AS gen_attr_317#453, rev_rollup_id#1278 AS gen_attr_315#462]
>             :     :     :     :     :     :     :           +- *(3) Filter 
> isnotnull(cntry_id#1269)
>             :     :     :     :     :     :     :              +- *(3) 
> ColumnarToRow
>             :     :     :     :     :     :     :                 +- FileScan 
> parquet default.small_table2[cntry_id#1269,rev_rollup_id#1278] Batched: true, 
> DataFilters: [isnotnull(cntry_id#1269)], Format: Parquet, Location: 
> InMemoryFileIndex[file:/user/hive/warehouse/small_table2], PartitionFilters: 
> [], PushedFilters: [IsNotNull(cntry_id)], ReadSchema: 
> struct<cntry_id:decimal(4,0),rev_rollup_id:smallint>
>             :     :     :     :     :     :     +- BroadcastExchange 
> HashedRelationBroadcastMode(List(cast(cast(input[0, smallint, true] as int) 
> as bigint))), [id=#315]
>             :     :     :     :     :     :        +- *(4) Project 
> [rev_rollup_id#1286 AS gen_attr_316#562, curncy_id#1289 AS gen_attr_313#565]
>             :     :     :     :     :     :           +- *(4) Filter 
> isnotnull(rev_rollup_id#1286)
>             :     :     :     :     :     :              +- *(4) ColumnarToRow
>             :     :     :     :     :     :                 +- FileScan 
> parquet default.small_table3[rev_rollup_id#1286,curncy_id#1289] Batched: 
> true, DataFilters: [isnotnull(rev_rollup_id#1286)], Format: Parquet, 
> Location: InMemoryFileIndex[file:/user/hive/warehouse/small_table3], 
> PartitionFilters: [], PushedFilters: [IsNotNull(rev_rollup_id)], ReadSchema: 
> struct<rev_rollup_id:smallint,curncy_id:decimal(4,0)>
>             :     :     :     :     :     +- BroadcastExchange 
> HashedRelationBroadcastMode(List(cast(input[0, decimal(9,0), true] as 
> decimal(20,0)))), [id=#324]
>             :     :     :     :     :        +- *(5) Project [CURNCY_ID#1263 
> AS gen_attr_314#591]
>             :     :     :     :     :           +- *(5) Filter 
> isnotnull(CURNCY_ID#1263)
>             :     :     :     :     :              +- *(5) ColumnarToRow
>             :     :     :     :     :                 +- FileScan parquet 
> default.small_table1[CURNCY_ID#1263] Batched: true, DataFilters: 
> [isnotnull(CURNCY_ID#1263)], Format: Parquet, Location: 
> InMemoryFileIndex[file:/user/hive/warehouse/small_table1], PartitionFilters: 
> [], PushedFilters: [IsNotNull(CURNCY_ID)], ReadSchema: 
> struct<CURNCY_ID:decimal(9,0)>, SelectedBucketsCount: 1 out of 1
>             :     :     :     :     +- BroadcastExchange 
> HashedRelationBroadcastMode(List(cast(input[0, decimal(4,0), true] as 
> decimal(20,0)))), [id=#333]
>             :     :     :     :        +- *(6) Project [cntry_id#1269 AS 
> gen_attr_312#665, rev_rollup_id#1278 AS gen_attr_310#674]
>             :     :     :     :           +- *(6) Filter 
> isnotnull(cntry_id#1269)
>             :     :     :     :              +- *(6) ColumnarToRow
>             :     :     :     :                 +- FileScan parquet 
> default.small_table2[cntry_id#1269,rev_rollup_id#1278] Batched: true, 
> DataFilters: [isnotnull(cntry_id#1269)], Format: Parquet, Location: 
> InMemoryFileIndex[file:/user/hive/warehouse/small_table2], PartitionFilters: 
> [], PushedFilters: [IsNotNull(cntry_id)], ReadSchema: 
> struct<cntry_id:decimal(4,0),rev_rollup_id:smallint>
>             :     :     :     +- BroadcastExchange 
> HashedRelationBroadcastMode(List(cast(cast(input[0, smallint, true] as int) 
> as bigint))), [id=#342]
>             :     :     :        +- *(7) Project [rev_rollup_id#1286 AS 
> gen_attr_311#774, curncy_id#1289 AS gen_attr_308#777]
>             :     :     :           +- *(7) Filter 
> isnotnull(rev_rollup_id#1286)
>             :     :     :              +- *(7) ColumnarToRow
>             :     :     :                 +- FileScan parquet 
> default.small_table3[rev_rollup_id#1286,curncy_id#1289] Batched: true, 
> DataFilters: [isnotnull(rev_rollup_id#1286)], Format: Parquet, Location: 
> InMemoryFileIndex[file:/user/hive/warehouse/small_table3], PartitionFilters: 
> [], PushedFilters: [IsNotNull(rev_rollup_id)], ReadSchema: 
> struct<rev_rollup_id:smallint,curncy_id:decimal(4,0)>
>             :     :     +- BroadcastExchange 
> HashedRelationBroadcastMode(List(cast(input[0, decimal(9,0), true] as 
> decimal(20,0)))), [id=#351]
>             :     :        +- *(8) Project [CURNCY_ID#1263 AS 
> gen_attr_309#803]
>             :     :           +- *(8) Filter isnotnull(CURNCY_ID#1263)
>             :     :              +- *(8) ColumnarToRow
>             :     :                 +- FileScan parquet 
> default.small_table1[CURNCY_ID#1263] Batched: true, DataFilters: 
> [isnotnull(CURNCY_ID#1263)], Format: Parquet, Location: 
> InMemoryFileIndex[file:/user/hive/warehouse/small_table1], PartitionFilters: 
> [], PushedFilters: [IsNotNull(CURNCY_ID)], ReadSchema: 
> struct<CURNCY_ID:decimal(9,0)>, SelectedBucketsCount: 1 out of 1
>             :     +- BroadcastExchange 
> HashedRelationBroadcastMode(List(input[0, decimal(4,0), true])), [id=#360]
>             :        +- *(9) Project [cntry_id#1269, rev_rollup#1279]
>             :           +- *(9) Filter isnotnull(cntry_id#1269)
>             :              +- *(9) ColumnarToRow
>             :                 +- FileScan parquet 
> default.small_table2[cntry_id#1269,rev_rollup#1279] Batched: true, 
> DataFilters: [isnotnull(cntry_id#1269)], Format: Parquet, Location: 
> InMemoryFileIndex[file:/user/hive/warehouse/small_table2], PartitionFilters: 
> [], PushedFilters: [IsNotNull(cntry_id)], ReadSchema: 
> struct<cntry_id:decimal(4,0),rev_rollup:string>
>             +- ReusedExchange [cntry_id#1309, rev_rollup#1319], 
> BroadcastExchange HashedRelationBroadcastMode(List(input[0, decimal(4,0), 
> true])), [id=#360]
> {noformat}
> {{ResolveRelations}} connected to Hive metastore 10 times at least to get 5 
> tables relation: big_table1, small_table1, small_table2, small_table3, 
> big_view1.
> We can reduce it to 5 times.
> After SPARK-29606 and before this  improvement:
> {noformat}
> === Metrics of Analyzer/Optimizer Rules ===
> Total number of runs: 9323
> Total time: 2.687441263 seconds
> Rule                                                                          
>                      Effective Time / Total Time                     
> Effective Runs / Total Runs
> org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveRelations              
>                      929173767 / 930133504                           2 / 18
> org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveTables                 
>                      0 / 383363402                                   0 / 18
> org.apache.spark.sql.catalyst.optimizer.EliminateOuterJoin                    
>                      0 / 99433540                                    0 / 4
> org.apache.spark.sql.catalyst.analysis.DecimalPrecision                       
>                      41809394 / 83727901                             2 / 18
> org.apache.spark.sql.execution.datasources.PruneFileSourcePartitions          
>                      71372977 / 71372977                             1 / 1
> org.apache.spark.sql.catalyst.analysis.TypeCoercion$ImplicitTypeCasts         
>                      0 / 59071933                                    0 / 18
> org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveReferences             
>                      37858325 / 58471776                             5 / 18
> org.apache.spark.sql.catalyst.analysis.TypeCoercion$PromoteStrings            
>                      20889892 / 53229016                             1 / 18
> org.apache.spark.sql.catalyst.analysis.TypeCoercion$FunctionArgumentConversion
>                      23428968 / 50890815                             1 / 18
> org.apache.spark.sql.catalyst.analysis.TypeCoercion$InConversion              
>                      23230666 / 49182607                             1 / 18
> org.apache.spark.sql.catalyst.analysis.Analyzer$ExtractGenerator              
>                      0 / 43638350                                    0 / 18
> org.apache.spark.sql.catalyst.optimizer.ColumnPruning                         
>                      17194844 / 42530885                             1 / 6
> org.apache.spark.sql.catalyst.analysis.TypeCoercion$DateTimeOperations        
>                      0 / 38274770                                    0 / 18
> org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveFunctions              
>                      12542573 / 34291171                             4 / 18
> org.apache.spark.sql.catalyst.analysis.TypeCoercion$ConcatCoercion            
>                      0 / 28824691                                    0 / 18
> org.apache.spark.sql.catalyst.analysis.ResolveTimeZone                        
>                      15433687 / 27543122                             6 / 18
> {noformat}
> After SPARK-29606 and this  improvement:
> {noformat}
> === Metrics of Analyzer/Optimizer Rules ===
> Total number of runs: 9323
> Total time: 2.163765869 seconds
> Rule                                                                          
>                      Effective Time / Total Time                     
> Effective Runs / Total Runs
> org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveRelations              
>                      658905353 / 659829383                           2 / 18
> org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveTables                 
>                      0 / 220708715                                   0 / 18
> org.apache.spark.sql.catalyst.optimizer.EliminateOuterJoin                    
>                      0 / 99606816                                    0 / 4
> org.apache.spark.sql.catalyst.analysis.DecimalPrecision                       
>                      39616060 / 78215752                             2 / 18
> org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveReferences             
>                      36706549 / 54917789                             5 / 18
> org.apache.spark.sql.execution.datasources.PruneFileSourcePartitions          
>                      53561921 / 53561921                             1 / 1
> org.apache.spark.sql.catalyst.analysis.TypeCoercion$ImplicitTypeCasts         
>                      0 / 52329678                                    0 / 18
> org.apache.spark.sql.catalyst.analysis.TypeCoercion$PromoteStrings            
>                      20945755 / 49695998                             1 / 18
> org.apache.spark.sql.catalyst.analysis.TypeCoercion$FunctionArgumentConversion
>                      20872241 / 46740145                             1 / 18
> org.apache.spark.sql.catalyst.analysis.TypeCoercion$InConversion              
>                      19780298 / 44327227                             1 / 18
> org.apache.spark.sql.catalyst.analysis.Analyzer$ExtractGenerator              
>                      0 / 42312023                                    0 / 18
> org.apache.spark.sql.catalyst.optimizer.ColumnPruning                         
>                      17197393 / 39501424                             1 / 6
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to