大数据计算MaxCompute这个是查询不了吗?数据太大? -[阿里云_云淘科技]

大数据计算MaxCompute这个是查询不了吗?数据太大?ODPS-1850001: Unsupported feature in session mode – Non select query not supported.INSERT OVERWRITE TABLE fz_bigdata.dw_user_property_di PARTITION (dt= ‘20240102’)
SELECT user_id,
‘cookie’ as user_type,
MAX(phone) as phone,
MAX(username) as username,
MAX(CASE WHEN username IS NOT NULL AND username ” THEN ‘有’ END) AS is_username,
arg_max(dt, gender ) filter (where gender is not null) as gender,
arg_max(dt, c_gender ) filter (where c_gender is not null) as c_gender,
arg_max(dt, birthday ) filter (where birthday is not null) as birthday,
arg_max(dt, hour ) filter (where hour is not null) as hour,
arg_max(dt, age ) filter (where age is not null) as age,
arg_max(dt, zodiac ) filter (where zodiac is not null) as zodiac,
array_distinct(flatten(collect_list(births))) as births,
array_distinct(flatten(collect_list(loves))) as loves,
array_distinct(flatten(collect_list(citys))) as citys,
array_distinct(flatten(collect_list(provinces))) as provinces,
array_distinct(flatten(collect_list(channels))) as channels,
array_distinct(flatten(collect_list(result_page_three_view_product_types))) as result_page_three_view_product_types,
array_distinct(flatten(collect_list(result_page_pay_product_types))) as result_page_pay_product_types,
array_distinct(flatten(collect_list(result_page_repurchase_product_types))) as result_page_repurchase_product_types,
arg_max(dt, is_result_page_repurchase ) filter (where is_result_page_repurchase is not null) as is_result_page_repurchase,
arg_max(dt, red_packet_use ) filter (where red_packet_use is not null) as red_packet_use
FROM fz_bigdata.dw_user_property_di WHERE dt in (‘20240101′,’20231231’ )
group by user_id

以下为热心网友提供的参考意见

这个查询是MaxCompute的SQL语法,用于在大数据计算中执行数据查询。它从表fz_bigdata.dw_user_property_di中选择数据,并对结果进行分组和聚合操作。

然而,根据您提供的错误信息”ODPS-1850001: Unsupported feature in session mode – Non select query not supported.”,可以看出该查询不支持在会话模式下执行非SELECT查询。这意味着您无法直接在MaxCompute中使用INSERT OVERWRITE语句来覆盖表fz_bigdata.dw_user_property_di的数据。

如果您需要将查询结果写入表fz_bigdata.dw_user_property_di,您可以使用INSERT INTO语句来实现。以下是一个示例代码片段:

INSERT INTO fz_bigdata.dw_user_property_di (user_id, user_type, phone, username, is_username, gender, c_gender, birthday, hour, age, zodiac, births, loves, citys, provinces, channels, result_page_three_view_product_types, result_page_pay_product_types, result_page_repurchase_product_types, is_result_page_repurchase, red_packet_use)
SELECT user_id,
'cookie' as user_type,
MAX(phone) as phone,
MAX(username) as username,
MAX(CASE WHEN username IS NOT NULL AND username  '' THEN '有' END) AS is_username,
arg_max(dt, gender ) filter (where gender is not null) as gender,
arg_max(dt, c_gender ) filter (where c_gender is not null) as c_gender,
arg_max(dt, birthday ) filter (where birthday is not null) as birthday,
arg_max(dt, hour ) filter (where hour is not null) as hour,
arg_max(dt, age ) filter (where age is not null) as age,
arg_max(dt, zodiac ) filter (where zodiac is not null) as zodiac,
array_distinct(flatten(collect_list(births))) as births,
array_distinct(flatten(collect_list(loves))) as loves,
array_distinct(flatten(collect_list(citys))) as citys,
array_distinct(flatten(collect_list(provinces))) as provinces,
array_distinct(flatten(collect_list(channels))) as channels,
array_distinct(flatten(collect_list(result_page_three_view_product_types))) as result_page_three_view_product_types,
array_distinct(flatten(collect_list(result_page_pay_product_types))) as result_page_pay_product_types,
array_distinct(flatten(collect_list(result_page_repurchase_product_types))) as result_page_repurchase_product_types,
arg_max(dt, is_result_page_repurchase ) filter (where is_result_page_repurchase is not null) as is_result_page_repurchase,
arg_max(dt, red_packet_use ) filter (where red_packet_use is not null) as red_packet_use
FROM fz_bigdata.dw_user_property_di WHERE dt in ('20240101','20231231' )
group by user_id;

请注意,上述代码中的列名和表名可能需要根据您的实际情况进行调整。另外,确保您的MaxCompute账户具有足够的权限来执行INSERT INTO语句,并且目标表fz_bigdata.dw_user_property_di已经存在并具有正确的结构。

本文来自投稿,不代表新手站长_郑州云淘科技有限公司立场,如若转载,请注明出处:https://www.cnzhanzhang.com/21455.html

(0)
匿名
上一篇 2024年1月10日
下一篇 2024年1月10日

相关推荐

新手站长从“心”出发,感谢16年您始终不离不弃。