MCPcopy Create free account
hub / github.com/microsoft/SandDance / WindowState

Function WindowState

docs/app/js/sanddance-app.js:118831–118861  ·  view source on GitHub ↗
(_3)

Source from the content-addressed store, hash-verified

118829}
118830const ValidWindowOps = Object.keys(WindowOps);
118831function WindowState(_3) {
118832 const ops = (0, _vegaUtil.array)(_3.ops), fields = (0, _vegaUtil.array)(_3.fields), params = (0, _vegaUtil.array)(_3.params), as = (0, _vegaUtil.array)(_3.as), outputs = this.outputs = [], windows = this.windows = [], inputs = {}, map = {}, counts = [], measures = [];
118833 let countOnly = true;
118834 function visitInputs(f) {
118835 (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(f)).forEach((_)=>inputs[_] = 1);
118836 }
118837 visitInputs(_3.sort);
118838 ops.forEach((op, i)=>{
118839 const field = fields[i], mname = (0, _vegaUtil.accessorName)(field), name = measureName(op, mname, as[i]);
118840 visitInputs(field);
118841 outputs.push(name); // Window operation
118842 if ((0, _vegaUtil.hasOwnProperty)(WindowOps, op)) windows.push(WindowOp(op, fields[i], params[i], name));
118843 else {
118844 if (field == null && op !== "count") (0, _vegaUtil.error)("Null aggregate field specified.");
118845 if (op === "count") {
118846 counts.push(name);
118847 return;
118848 }
118849 countOnly = false;
118850 let m = map[mname];
118851 if (!m) {
118852 m = map[mname] = [];
118853 m.field = field;
118854 measures.push(m);
118855 }
118856 m.push(createMeasure(op, name));
118857 }
118858 });
118859 if (counts.length || measures.length) this.cell = cell(measures, counts, countOnly);
118860 this.inputs = Object.keys(inputs);
118861}
118862const prototype = WindowState.prototype;
118863prototype.init = function() {
118864 this.windows.forEach((_)=>_.init());

Callers

nothing calls this directly

Calls 6

visitInputsFunction · 0.70
measureNameFunction · 0.70
WindowOpFunction · 0.70
createMeasureFunction · 0.70
cellFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected