带有not like 过滤条件 ,partition by 的sql执行结果不稳定

为了更快的定位您的问题,请提供以下信息,谢谢
【详述】相同的sql,带有not like 过滤条件 ,partition by 的sql执行结果不稳定,另一个不带not like过滤条件的查询结果是稳定的。
【背景】做过哪些操作?
【业务影响】影响客户的数据统计,结果不准确
【是否存算分离】
【StarRocks版本】例如:1.18.2
【集群规模】例如:3fe(1 follower+2observer)+5be(fe与be混部)
【机器信息】CPU虚拟核/内存/网卡,例如:48C/64G/万兆
【联系方式】为了在解决问题过程中能及时联系到您获取一些日志信息,请补充下您的联系方式,例如:
【附件】
select
t10.__fcol_63 as __fcol_74,
t10.__fcol_64 as __fcol_75,
t10.__fcol_65 as __fcol_76,
t10.__fcol_66 as __fcol_77,
t10.__fcol_67 as __fcol_78,
t10.__fcol_68 as __fcol_79,
t10.__fcol_69 as __fcol_80,
t10.__fcol_70 as __fcol_81,
t10.__fcol_71 as __fcol_82,
t10.__fcol_72 as __fcol_83,
t10.__fcol_73 as __fcol_84
from (
select
t2.__fcol_4 as __fcol_63,
t2.__fcol_5 as __fcol_64,
t8.__fcol_46 as __fcol_65,
t8.__fcol_47 as __fcol_66,
t8.__fcol_48 as __fcol_67,
t8.__fcol_49 as __fcol_68,
t8.__fcol_50 as __fcol_69,
t8.__fcol_51 as __fcol_70,
t8.__fcol_52 as __fcol_71,
t2.__fcol_6 as __fcol_72,
sum(t2.__fcol_5) over (partition by t8.__fcol_48) as __fcol_73
from (
select
T_5B670BB1DC20447C8E416.product_wid as __fcol_4,
T_5B670BB1DC20447C8E416.sales_amount_notax as __fcol_5,
t0.__fcol_0 as __fcol_6
from hive_catalog.jydwd.dw_f_so_mmt_all_detail_dealer as T_5B670BB1DC20447C8E416
join (
select T_5064609E1B1D4689A7084.day_id as __fcol_0
from hive_catalog.jydwd.dw_d_days as T_5064609E1B1D4689A7084
where (
T_5064609E1B1D4689A7084.period_start_date < date(‘2025-08-01’)
and T_5064609E1B1D4689A7084.year_start_date >= str_to_date(concat(
cast((case
when month(current_date()) = 1 then (year(current_date()) - 2)
else year(current_date())
end - 1) as varchar),
‘-’,
cast(1 as varchar),
‘-’,
cast(1 as varchar)
), ‘%Y-%m-%d’)
)
) as t0
on T_5B670BB1DC20447C8E416.day_wid = t0.__fcol_0
) as t2
join (
select
t7.__fcol_38 as __fcol_46,
t7.__fcol_39 as __fcol_47,
t7.__fcol_40 as __fcol_48,
t7.__fcol_41 as __fcol_49,
t7.__fcol_42 as __fcol_50,
t7.__fcol_43 as __fcol_51,
t7.__fcol_45 as __fcol_52
from (
select
t6.__fcol_30 as __fcol_38,
t6.__fcol_31 as __fcol_39,
t6.__fcol_32 as __fcol_40,
t6.__fcol_33 as __fcol_41,
t6.__fcol_34 as __fcol_42,
t6.__fcol_35 as __fcol_43,
max(t6.__fcol_37) over (partition by t6.__fcol_32) as __fcol_45
from (
select
t5.__fcol_22 as __fcol_30,
t5.__fcol_23 as __fcol_31,
t5.__fcol_24 as __fcol_32,
t5.__fcol_25 as __fcol_33,
t5.__fcol_26 as __fcol_34,
t5.__fcol_29 as __fcol_35,
case
when t5.__fcol_27 is null then cast(str_to_date(concat(
cast(9999 as varchar),
‘-’,
cast(1 as varchar),
‘-’,
cast(1 as varchar)
), ‘%Y-%m-%d’) as datetime)
else t5.__fcol_27
end as __fcol_37
from (
select
t4.__fcol_14 as __fcol_22,
t4.__fcol_15 as __fcol_23,
t4.__fcol_16 as __fcol_24,
t4.__fcol_17 as __fcol_25,
t4.__fcol_18 as __fcol_26,
t4.__fcol_19 as __fcol_27,
min(t4.__fcol_21) over (partition by t4.__fcol_16) as __fcol_29
from (
select
t3.__fcol_7 as __fcol_14,
t3.__fcol_8 as __fcol_15,
t3.__fcol_9 as __fcol_16,
t3.__fcol_10 as __fcol_17,
t3.__fcol_11 as __fcol_18,
t3.__fcol_13 as __fcol_19,
case
when t3.__fcol_12 is null then cast(str_to_date(concat(
cast(9999 as varchar),
‘-’,
cast(1 as varchar),
‘-’,
cast(1 as varchar)
), ‘%Y-%m-%d’) as datetime)
else t3.__fcol_12
end as __fcol_21
from (
select
T_F84A2603641C4067925C6.row_wid as __fcol_7,
T_F84A2603641C4067925C6.product_num as __fcol_8,
T_F84A2603641C4067925C6.report_category_name03 as __fcol_9,
T_F84A2603641C4067925C6.product_line_name as __fcol_10,
T_F84A2603641C4067925C6.product_att_value18 as __fcol_11,
cast(T_F84A2603641C4067925C6.product_att_value21 as datetime) as __fcol_12,
cast(T_F84A2603641C4067925C6.product_att_value22 as datetime) as __fcol_13
from hive_catalog.jydwd.dw_d_org_product as T_F84A2603641C4067925C6
) as t3
) as t4
) as t5
) as t6
) as t7
where t7.__fcol_45 >= timestamp(‘2025-07-31 00:00:00.0’)
) as t8
on t2.__fcol_4 = t8.__fcol_46
) as t10
where t10.__fcol_66 in (‘10301001941’)
limit 5000 查询结果正常。

select
t10.__fcol_63 as __fcol_74,
t10.__fcol_64 as __fcol_75,
t10.__fcol_65 as __fcol_76,
t10.__fcol_66 as __fcol_77,
t10.__fcol_67 as __fcol_78,
t10.__fcol_68 as __fcol_79,
t10.__fcol_69 as __fcol_80,
t10.__fcol_70 as __fcol_81,
t10.__fcol_71 as __fcol_82,
t10.__fcol_72 as __fcol_83,
t10.__fcol_73 as __fcol_84
from (
select
t2.__fcol_4 as __fcol_63,
t2.__fcol_5 as __fcol_64,
t2.__fcol_6 as __fcol_65,
t8.__fcol_46 as __fcol_66,
t8.__fcol_47 as __fcol_67,
t8.__fcol_48 as __fcol_68,
t8.__fcol_49 as __fcol_69,
t8.__fcol_50 as __fcol_70,
t8.__fcol_51 as __fcol_71,
t8.__fcol_52 as __fcol_72,
sum(t2.__fcol_5) over (partition by t8.__fcol_48) as __fcol_73
from (
select
T_5B670BB1DC20447C8E416.product_wid as __fcol_4,
T_5B670BB1DC20447C8E416.sales_amount_notax as __fcol_5,
t0.__fcol_0 as __fcol_6
from hive_catalog.jydwd.dw_f_so_mmt_all_detail_dealer as T_5B670BB1DC20447C8E416
join (
select T_5064609E1B1D4689A7084.day_id as __fcol_0
from hive_catalog.jydwd.dw_d_days as T_5064609E1B1D4689A7084
where (
T_5064609E1B1D4689A7084.period_start_date < date(‘2025-08-01’)
and T_5064609E1B1D4689A7084.year_start_date >= str_to_date(concat(
cast((case
when month(current_date()) = 1 then (year(current_date()) - 2)
else year(current_date())
end - 1) as varchar),
‘-’,
cast(1 as varchar),
‘-’,
cast(1 as varchar)
), ‘%Y-%m-%d’)
)
) as t0
on T_5B670BB1DC20447C8E416.day_wid = t0.__fcol_0
) as t2
join (
select
t7.__fcol_38 as __fcol_46,
t7.__fcol_39 as __fcol_47,
t7.__fcol_40 as __fcol_48,
t7.__fcol_41 as __fcol_49,
t7.__fcol_42 as __fcol_50,
t7.__fcol_43 as __fcol_51,
t7.__fcol_45 as __fcol_52
from (
select
t6.__fcol_30 as __fcol_38,
t6.__fcol_31 as __fcol_39,
t6.__fcol_32 as __fcol_40,
t6.__fcol_33 as __fcol_41,
t6.__fcol_34 as __fcol_42,
t6.__fcol_35 as __fcol_43,
max(t6.__fcol_37) over (partition by t6.__fcol_32) as __fcol_45
from (
select
t5.__fcol_22 as __fcol_30,
t5.__fcol_23 as __fcol_31,
t5.__fcol_24 as __fcol_32,
t5.__fcol_25 as __fcol_33,
t5.__fcol_26 as __fcol_34,
t5.__fcol_29 as __fcol_35,
case
when t5.__fcol_27 is null then cast(str_to_date(concat(
cast(9999 as varchar),
‘-’,
cast(1 as varchar),
‘-’,
cast(1 as varchar)
), ‘%Y-%m-%d’) as datetime)
else t5.__fcol_27
end as __fcol_37
from (
select
t4.__fcol_14 as __fcol_22,
t4.__fcol_15 as __fcol_23,
t4.__fcol_16 as __fcol_24,
t4.__fcol_17 as __fcol_25,
t4.__fcol_18 as __fcol_26,
t4.__fcol_19 as __fcol_27,
min(t4.__fcol_21) over (partition by t4.__fcol_16) as __fcol_29
from (
select
t3.__fcol_7 as __fcol_14,
t3.__fcol_8 as __fcol_15,
t3.__fcol_9 as __fcol_16,
t3.__fcol_10 as __fcol_17,
t3.__fcol_11 as __fcol_18,
t3.__fcol_13 as __fcol_19,
case
when t3.__fcol_12 is null then cast(str_to_date(concat(
cast(9999 as varchar),
‘-’,
cast(1 as varchar),
‘-’,
cast(1 as varchar)
), ‘%Y-%m-%d’) as datetime)
else t3.__fcol_12
end as __fcol_21
from (
select
T_F84A2603641C4067925C6.row_wid as __fcol_7,
T_F84A2603641C4067925C6.product_num as __fcol_8,
T_F84A2603641C4067925C6.report_category_name03 as __fcol_9,
T_F84A2603641C4067925C6.product_line_name as __fcol_10,
T_F84A2603641C4067925C6.product_att_value18 as __fcol_11,
cast(T_F84A2603641C4067925C6.product_att_value21 as datetime) as __fcol_12,
cast(T_F84A2603641C4067925C6.product_att_value22 as datetime) as __fcol_13
from hive_catalog.jydwd.dw_d_org_product as T_F84A2603641C4067925C6
) as t3
where t3.__fcol_8 not like ‘%OS%’
) as t4
) as t5
) as t6
) as t7
where t7.__fcol_45 >= timestamp(‘2025-07-31 00:00:00.0’)
) as t8
on t2.__fcol_4 = t8.__fcol_46
) as t10
where t10.__fcol_67 in (‘10301001941’)
limit 5000

sum(t2.__fcol_5) over (partition by t8.__fcol_48) as __fcol_73 结果每次都不一样, 这个查询对比上面的就多了一个 where t3.__fcol_8 not like ‘%OS%’ 条件,为什么会导致结果不稳定?