Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query result is wrong #17673

Closed
ZiheLiu opened this issue Feb 10, 2023 · 0 comments · Fixed by #17666
Closed

Query result is wrong #17673

ZiheLiu opened this issue Feb 10, 2023 · 0 comments · Fixed by #17666
Labels
type/bug Something isn't working

Comments

@ZiheLiu
Copy link
Contributor

ZiheLiu commented Feb 10, 2023

Steps to reproduce the behavior (Required)

Prepare Data

CREATE TABLE t0 (
  k1 int(11) NULL COMMENT "",
  c1 int(11) NULL COMMENT ""
) ENGINE=OLAP
DUPLICATE KEY(k1)
COMMENT "OLAP"
PARTITION BY RANGE(`c1`) (
    PARTITION `p1` values LESS THAN ("100000"),
    PARTITION `p2` values LESS THAN ("2000000")
)
DISTRIBUTED BY HASH(`k1`) BUCKETS 6
PROPERTIES (
    "replication_num" = "3",
    "colocate_with" = "group_9e1f817a_a160_11ed_957f_00163e04d4c2"
);
        
insert intot0 (k1, c1)values (0, 10), (0, 10), (0, 100000), (0, 100000), (1, 11), (1, 11), (1, 100001), (1, 100001), (2, 12), (2, 12), (2, 100002), (2, 100002), (3, 13), (3, 13), (3, 100003), (3, 100003), (4, 14), (4, 14), (4, 100004), (4, 100004), (5, 15), (5, 15), (5, 100005), (5, 100005), (6, 16), (6, 16), (6, 100006), (6, 100006), (7, 17), (7, 17), (7, 100007), (7, 100007), (8, 18), (8, 18), (8, 100008), (8, 100008), (9, 19), (9, 19), (9, 100009), (9, 100009), (10, 20), (10, 20), (10, 100010), (10, 100010), (11, 21), (11, 21), (11, 100011), (11, 100011), (12, 22), (12, 22), (12, 100012), (12, 100012), (13, 23), (13, 23), (13, 100013), (13, 100013), (14, 24), (14, 24), (14, 100014), (14, 100014), (15, 25), (15, 25), (15, 100015), (15, 100015), (16, 26), (16, 26), (16, 100016), (16, 100016), (17, 27), (17, 27), (17, 100017), (17, 100017), (18, 28), (18, 28), (18, 100018), (18, 100018), (19, 29), (19, 29), (19, 100019), (19, 100019), (20, 30), (20, 30), (20, 100020), (20, 100020), (21, 31), (21, 31), (21, 100021), (21, 100021), (22, 32), (22, 32), (22, 100022), (22, 100022), (23, 33), (23, 33), (23, 100023), (23, 100023), (24, 34), (24, 34), (24, 100024), (24, 100024), (25, 35), (25, 35), (25, 100025), (25, 100025), (26, 36), (26, 36), (26, 100026), (26, 100026), (27, 37), (27, 37), (27, 100027), (27, 100027), (28, 38), (28, 38), (28, 100028), (28, 100028), (29, 39), (29, 39), (29, 100029), (29, 100029), (30, 40), (30, 40), (30, 100030), (30, 100030), (31, 41), (31, 41), (31, 100031), (31, 100031), (32, 42), (32, 42), (32, 100032), (32, 100032), (33, 43), (33, 43), (33, 100033), (33, 100033), (34, 44), (34, 44), (34, 100034), (34, 100034), (35, 45), (35, 45), (35, 100035), (35, 100035), (36, 46), (36, 46), (36, 100036), (36, 100036), (37, 47), (37, 47), (37, 100037), (37, 100037), (38, 48), (38, 48), (38, 100038), (38, 100038), (39, 49), (39, 49), (39, 100039), (39, 100039), (40, 50), (40, 50), (40, 100040), (40, 100040), (41, 51), (41, 51), (41, 100041), (41, 100041), (42, 52), (42, 52), (42, 100042), (42, 100042), (43, 53), (43, 53), (43, 100043), (43, 100043), (44, 54), (44, 54), (44, 100044), (44, 100044), (45, 55), (45, 55), (45, 100045), (45, 100045), (46, 56), (46, 56), (46, 100046), (46, 100046), (47, 57), (47, 57), (47, 100047), (47, 100047), (48, 58), (48, 58), (48, 100048), (48, 100048), (49, 59), (49, 59), (49, 100049), (49, 100049), (50, 60), (50, 60), (50, 100050), (50, 100050), (51, 61), (51, 61), (51, 100051), (51, 100051), (52, 62), (52, 62), (52, 100052), (52, 100052), (53, 63), (53, 63), (53, 100053), (53, 100053), (54, 64), (54, 64), (54, 100054), (54, 100054), (55, 65), (55, 65), (55, 100055), (55, 100055), (56, 66), (56, 66), (56, 100056), (56, 100056), (57, 67), (57, 67), (57, 100057), (57, 100057), (58, 68), (58, 68), (58, 100058), (58, 100058), (59, 69), (59, 69), (59, 100059), (59, 100059);

Query

            with
                w1 as (
                    select wv2.k1, wv2.c1
                    from t0 wv1 join [colocate] t0 wv2 using(k1, c1)
                ) 
            select /*+ SET_VAR(pipeline_dop=8, 
                               new_planner_agg_stage=0, 
                               enable_tablet_internal_parallel=true) */    
                ifnull(sum(murmur_hash3_32(k1)), 0)
                    + ifnull(sum(murmur_hash3_32(sum_c1)), 0)
            from (
                select k1, sum(c1) sum_c1 from w1 group by k1
            ) tmp

Expected behavior (Required)

+-----------------------------------------------------------------------------------+
| (ifnull(sum(murmur_hash3_32(k1)), 0)) + (ifnull(sum(murmur_hash3_32(sum_c1)), 0)) |
+-----------------------------------------------------------------------------------+
| 8196134612                                                                        |
+-----------------------------------------------------------------------------------+

Real behavior (Required)

+-----------------------------------------------------------------------------------+
| (ifnull(sum(murmur_hash3_32(k1)), 0)) + (ifnull(sum(murmur_hash3_32(sum_c1)), 0)) |
+-----------------------------------------------------------------------------------+
| 1918732991                                                                        |
+-----------------------------------------------------------------------------------+

StarRocks version (Required)

  • You can get the StarRocks version by executing SQL select current_version()
@ZiheLiu ZiheLiu added the type/bug Something isn't working label Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant