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

$columns + subquery stop works after 3.1.1 #565

Closed
Slach opened this issue May 23, 2024 · 2 comments · Fixed by #577
Closed

$columns + subquery stop works after 3.1.1 #565

Slach opened this issue May 23, 2024 · 2 comments · Fixed by #577
Assignees
Labels
bug p2 Priority 2
Milestone

Comments

@Slach
Copy link
Collaborator

Slach commented May 23, 2024

$columns(concat('LID: ', toString(lid), ' | ', switch, ' ', mod, ' port ', toString(port), ' <=> ', r_switch, ' ', r_mod, ' port ', toString(r_port)) AS desc, median(lost_bw_pct) AS ratio) FROM $table WHERE $timeFilter AND dc = '$dc' AND port_type = 'spine' AND (lid, port) in (SELECT DISTINCT lid, port FROM $table WHERE $timeFilter AND host LIKE '%$host_type%' AND dc = '$dc' AND port_type = 'spine' GROUP BY lid,port ORDER BY max(lost_bw_pct) DESC LIMIT $top_count)

works only if added GROUP BY ALL

@Slach Slach added the bug label May 23, 2024
@Slach Slach added this to the 3.2.0 milestone May 27, 2024
@Slach Slach added the p2 Priority 2 label May 27, 2024
@Slach
Copy link
Collaborator Author

Slach commented Jun 3, 2024

Reproduce only case when have $top_count which not exists in template variables and replaced $to as timestamp

need error message and steps to reproduce

@Slach
Copy link
Collaborator Author

Slach commented Jun 11, 2024

more information for reproduce

source query

$columns(concat('LID: ', toString(lid), ' | ', switch, ' ', mod, ' port ', toString(port), ' = ', r_switch, ' ', r_mod, ' port ', toString(r_port)) AS desc, median(lost_bw_pct) AS ratio) FROM $table WHERE $timeFilter AND dc = 'fpip3' AND port_type = 'spine' AND (lid, port) in (SELECT DISTINCT lid, port FROM $table WHERE $timeFilter AND dc = 'fpip3' AND port_type = 'spine' GROUP BY lid,port ORDER BY max(lost_bw_pct) DESC LIMIT 10)

generated SQL

SELECT
    t,
    groupArray((desc, ratio)) AS groupArr
FROM
(
    SELECT
        (intDiv(toUInt32(_time), 1) * 1) * 1000 AS t,
        concat('LID: ', toString(lid), ' | ', switch, ' ', mod, ' port ', toString(port), ' = ', r_switch, ' ', r_mod, ' port ', toString(r_port)) AS desc,
        median(lost_bw_pct) AS ratio
    FROM default.ibstats_non_negative_rate
    WHERE (_time >= toDateTime(1718009046)) AND (_time <= toDateTime(1718009946)) AND (_time >= toDateTime(1718009046)) AND (_time <= toDateTime(1718009946)) AND (dc = 'fpip3') AND (port_type = 'spine') AND ((lid, port) IN (
        SELECT DISTINCT
            lid,
            port
        FROM default.ibstats_non_negative_rate
        WHERE (_time >= toDateTime(1718009046)) AND (_time <= toDateTime(1718009946)) AND (_time >= toDateTime(1718009046)) AND (_time <= toDateTime(1718009946)) AND (dc = 'fpip3') AND (port_type = 'spine')
        GROUP BY
            lid,
            port
        ORDER BY max(lost_bw_pct) DESC
        LIMIT 10
    ))
^^^^^^^ GROUP BY t, desc ^^^^^ missing here
)
GROUP BY t
ORDER BY t ASC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug p2 Priority 2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants