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

runningDifference/neighbor - deprecated #572

Open
Slach opened this issue Jun 3, 2024 · 1 comment
Open

runningDifference/neighbor - deprecated #572

Slach opened this issue Jun 3, 2024 · 1 comment
Labels
p1 Priority 1
Milestone

Comments

@Slach
Copy link
Collaborator

Slach commented Jun 3, 2024

Need clickhouse-server version specific implementations for macros which apply windows function for macros if possible

@Slach Slach added this to the 3.3.0 milestone Jun 20, 2024
@filimonov
Copy link
Member

filimonov commented Jun 20, 2024

smth like

SELECT 
  t,
  groupArray([type,diff]) as cntDiff
FROM
(
  WITH
    lagInFrame(cnt) OVER (PARTITION BY type ORDER BY t ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS prev_cnt,
    cnt - prev_cnt as diff
  SELECT
    t,
    type,
    diff
  FROM 
  (
    SELECT
      $timeSeries as t, 
      type,
      count() as cnt
    FROM $table 
    WHERE $timeFilter /* AND ... */
    GROUP BY t, type
  )
)
GROUP BY t
ORDER BY t

@Slach Slach changed the title runningX/neighbor - deprecated runningDifference/neighbor - deprecated Jun 24, 2024
@Slach Slach added the p1 Priority 1 label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1 Priority 1
Projects
None yet
Development

No branches or pull requests

2 participants