PageSourceSearch

https://docs.holistics.io/assets/js/f4bb0c61.b88aa462.js

js holistics.io collected 2026-09-24 09:00:46 UTC 8,485 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkholistics_docs=self.webpackChunkholistics_docs||[]).push([["10870"],{74607(e,n,r){r.r(n),r.d(n,{metadata:()=>i,default:()=>h,frontMatter:()=>t,contentTitle:()=>d,toc:()=>c,assets:()=>a});var i=JSON.parse('{"id":"reference/aql/window_varp","title":"window_varp","description":"AQL Window Function: A window aggregation function that returns the (sample) variance of rows in a range relative to the current row.\\n","source":"@site/docs/reference/aql/window_varp.md","sourceDirName":"reference/aql","slug":"/reference/aql/window_varp","permalink":"/reference/aql/window_varp","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{"title":"window_varp","description":"AQL Window Function: A window aggregation function that returns the (sample) variance of rows in a range relative to the current row.\\n"},"sidebar":"reference","previous":{"title":"window_var","permalink":"/reference/aql/window_var"},"next":{"title":"Aggregate Functions (Aggregators)","permalink":"/reference/aql/aggregator-functions"}}'),s=r(74848),o=r(28453);let t={title:"window_varp",description:"AQL Window Function: A window aggregation function that returns the (sample) variance of rows in a range relative to the current row.\n"},d,a={},c=[{value:"Definition",id:"definition",level:2},{value:"Sample Usages",id:"sample-usages",level:2},{value:"See also",id:"see-also",level:2}];function l(e){let n={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.admonition,{title:"Knowledge Checkpoint",type:"tip",children:[(0,s.jsx)(n.p,{children:"Readings that will help you understand this documentation better:"}),(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/reference/aql/window-function",children:"Window Functions Overview"})}),"\n"]})]}),"\n",(0,s.jsx)(n.h2,{id:"definition",children:"Definition"}),"\n",(0,s.jsx)(n.p,{children:"A window aggregation function that returns the (population) variance of rows in a range relative to the current row."}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"Syntax"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-aml",children:"window_varp(agg_expr)\nwindow_varp(agg_expr, order: order_expr, ...)\nwindow_varp(agg_expr, range, order: order_expr, ...)\nwindow_varp(agg_expr, range, order: order_expr, ..., reset: partition_expr, ...)\nwindow_varp(agg_expr, range, order: order_expr, ..., partition: partition_expr, ...)\n"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-aml",metastring:'title="Examples"',children:"window_varp(count(users.id))\nwindow_varp(count(users.id), order: count(users.id) | desc())\nwindow_varp(count(users.id), -2..2, order: users.created_at | month())\nwindow_varp(count(users.id), order: users.created_at | month(), reset: users.gender)\n\n// Axis-aware examples\nwindow_varp(revenue, order: 'rows')                          // Running variance across rows\nwindow_varp(revenue, order: 'columns', partition: 'rows')    // Running variance within each row\nwindow_varp(revenue, order: 'x_axis' | desc())               // Running variance in reverse row order\nwindow_varp(revenue, order: 'legend', partition: 'x_axis')   // Running variance within each column\n"})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"Input"})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"agg_expr"})," (",(0,s.jsx)(n.strong,{children:"required"}),"): An aggregation expression that we want to find the (population) variance of."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"range"})," (",(0,s.jsx)(n.strong,{children:"optional"}),"): A range of rows to include in the (population) variance. Negative values indicate rows before the current row, and positive values indicate rows after the current row, while 0 indicates the current row. If the beginning or end of the range is not specified, the range will include all rows from the beginning or end of the table. By default, if the range is not specified:","\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["If ",(0,s.jsx)(n.code,{children:"order"})," is specified, the range is ",(0,s.jsx)(n.code,{children:"..0"})," (from the first row to the current row)."]}),"\n",(0,s.jsxs)(n.li,{children:["If ",(0,s.jsx)(n.code,{children:"order"})," is not specified, the range is ",(0,s.jsx)(n.code,{children:".."})," (from the first row to the last row)."]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"order"})," (",(0,s.jsx)(n.strong,{children:"required"}),", ",(0,s.jsx)(n.strong,{children:"repeatable"}),"): A field that is used for ordering. The order defaults to ascending. The order 
1can be set explicitly with ",(0,s.jsx)(n.code,{children:"asc()"})," or ",(0,s.jsx)(n.code,{children:"desc()"}),". You can also use ",(0,s.jsx)(n.a,{href:"/reference/aql/window-function#axis-aware-window-functions",children:"axis references"}),":","\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"'rows'"})," or ",(0,s.jsx)(n.code,{children:"'x_axis'"}),": Order by dimensions mapped to rows/x-axis"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"'columns'"})," or ",(0,s.jsx)(n.code,{children:"'legend'"}),": Order by dimensions mapped to columns/legend"]}),"\n",(0,s.jsxs)(n.li,{children:["Axis references can be modified with ",(0,s.jsx)(n.code,{children:"asc()"})," or ",(0,s.jsx)(n.code,{children:"desc()"}),": ",(0,s.jsx)(n.code,{children:"order: 'rows' | desc()"})]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"warning",children:(0,s.jsxs)(n.p,{children:["If the specified order does not uniquely identify rows, the result of the function can be non-deterministic. For example, if you use ",(0,s.jsx)(n.code,{children:"order: users.age"}),", and there are multiple users with the same age in the same partition, the result can be unexpected."]})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"partition"})," or ",(0,s.jsx)(n.code,{children:"reset"})," (",(0,s.jsx)(n.strong,{children:"repeatable"}),", ",(0,s.jsx)(n.strong,{children:"optional"}),"): A field that is used for partitioning the table. You can also use ",(0,s.jsx)(n.a,{href:"/reference/aql/window-function#axis-aware-window-functions",children:"axis references"})," like ",(0,s.jsx)(n.code,{children:"'rows'"}),", ",(0,s.jsx)(n.code,{children:"'columns'"}),", ",(0,s.jsx)(n.code,{children:"'x_axis'"}),", or ",(0,s.jsx)(n.code,{children:"'legend'"}),". If partitions are not specified:","\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["If ",(0,s.jsx)(n.code,{children:"order"})," is specified, the table will be partitioned by all other grouping columns."]}),"\n",(0,s.jsxs)(n.li,{children:["If ",(0,s.jsx)(n.code,{children:"order"})," is not specified, the table will be considered as a single partition."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"Output"})}),"\n",(0,s.jsx)(n.p,{children:"The (population) variance of the current row and the rows within the specified range."}),"\n",(0,s.jsx)(n.h2,{id:"sample-usages",children:"Sample Usages"}),"\n",(0,s.jsxs)(n.p,{children:["Please refer to the sample usages in ",(0,s.jsx)(n.a,{href:"/reference/aql/window_stdev#sample-usages",children:"window_stdev"}),"."]}),"\n",(0,s.jsx)(n.h2,{id:"see-also",children:"See also"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/reference/aql/window_var",children:(0,s.jsx)(n.code,{children:"window_var()"})})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/reference/aql/window_stdevp",children:(0,s.jsx)(n.code,{children:"window_stdevp()"})})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"/reference/aql/window-function",children:"Window Functions"})}),"\n"]})]})}function h(e={}){let{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},28453(e,n,r){r.d(n,{R:()=>t,x:()=>d});var i=r(96540);let s={},o=i.createContext(s);function t(e){let n=i.useContext(o);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:t(e.components),i.createElement(o.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.