Starrocks创建物化视图时不能写select *

CREATE MATERIALIZED VIEW dw_stream.xxx_amv_sr

PARTITION BY date_trunc('DAY', pt)

DISTRIBUTED BY HASH(emp_id) BUCKETS 10 REFRESH ASYNC START('2024-07-17 16:47:02') EVERY(INTERVAL 1 minute)

PROPERTIES ( "replication_num" = "3", "storage_medium" = "HDD", "auto_refresh_partitions_limit" = "5", "partition_refresh_number" = "2", "partition_ttl_number" = "2" ) AS

select emp_id ,emp_name ,pt ,sum(case when item = 'foot' then amount else 0 end) as hot_put_get_send_wo_cnt ,sum(case when item = 'finish' then amount else 0 end) as hot_put_get_finish_wo_cnt ,sum(case when item = 'foot' then amount else 0 end) as gain_put_get_send_wo_cnt ,sum(case when item = 'finish' then amount else 0 end) as gain_put_get_finish_wo_cnt from

( select emp_id ,

emp_name ,

pt ,

item,

amount,

row_number() over(partition by pt,block_id,item order by gmt_modify desc) rn

from dw_stream.xxx_dup_sr

where item in ( 'foot' ,'finish' ) )a1 where rn = 1 group by emp_id,emp_name,pt

不能写成:

CREATE MATERIALIZED VIEW dw_stream.xxx_amv_sr

PARTITION BY date_trunc('DAY', pt)

DISTRIBUTED BY HASH(emp_id) BUCKETS 10 REFRESH ASYNC START('2024-07-17 16:47:02') EVERY(INTERVAL 1 minute)

PROPERTIES ( "replication_num" = "3", "storage_medium" = "HDD", "auto_refresh_partitions_limit" = "5", "partition_refresh_number" = "2", "partition_ttl_number" = "2" ) AS

select emp_id ,emp_name ,pt ,sum(case when item = 'foot' then amount else 0 end) as hot_put_get_send_wo_cnt ,sum(case when item = 'finish' then amount else 0 end) as hot_put_get_finish_wo_cnt ,sum(case when item = 'foot' then amount else 0 end) as gain_put_get_send_wo_cnt ,sum(case when item = 'finish' then amount else 0 end) as gain_put_get_finish_wo_cnt from

( select

*

row_number() over(partition by pt,block_id,item order by gmt_modify desc) rn

from dw_stream.xxx_dup_sr

where item in ( 'foot' ,'finish' ) )a1 where rn = 1 group by emp_id,emp_name,pt

相关推荐
Yz98761 天前
hive复杂数据类型Array & Map & Struct & 炸裂函数explode
大数据·数据库·数据仓库·hive·hadoop·数据库开发·big data
Yz98762 天前
Hive分桶超详细!!!
大数据·数据仓库·hive·hadoop·hdfs·数据库开发·big data
Data-Miner3 天前
12万字 | 企业智慧数字化运营平台重构建设项目实施技术方案
大数据·big data
标贝科技4 天前
标贝科技:AI基础数据服务,人工智能行业发展的底层支撑
人工智能·机器学习·语言模型·数据挖掘·自动驾驶·database·big data
Yz98765 天前
hive-内部表&外部表-详细介绍
大数据·数据仓库·hive·hadoop·数据库开发·big data
流浪在地球上的小朋友7 天前
移门缓冲支架:减少噪音,提升生活质量
大数据·搜索引擎·云计算·全文检索·big data
Data-Miner8 天前
大数据湖项目建设方案(100页WORD)
大数据·big data
Yz98769 天前
Kafka面试题
大数据·分布式·zookeeper·kafka·big data
zmd-zk10 天前
hive中windows子句的使用
大数据·数据仓库·hive·hadoop·windows·分布式·big data
Yz987611 天前
Hive的远程模式
大数据·linux·数据仓库·hive·hadoop·分布式·big data