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

Function WindowState

docs/tests/v2/es6/js/sanddance.js:92976–93033  ·  view source on GitHub ↗
(_)

Source from the content-addressed store, hash-verified

92974function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
92975
92976function WindowState(_) {
92977 let self = this,
92978 ops = (0, _vegaUtil.array)(_.ops),
92979 fields = (0, _vegaUtil.array)(_.fields),
92980 params = (0, _vegaUtil.array)(_.params),
92981 as = (0, _vegaUtil.array)(_.as),
92982 outputs = self.outputs = [],
92983 windows = self.windows = [],
92984 inputs = {},
92985 map = {},
92986 countOnly = true,
92987 counts = [],
92988 measures = [];
92989
92990 function visitInputs(f) {
92991 (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(f)).forEach(_ => inputs[_] = 1);
92992 }
92993
92994 visitInputs(_.sort);
92995 ops.forEach(function (op, i) {
92996 let field = fields[i],
92997 mname = (0, _vegaUtil.accessorName)(field),
92998 name = (0, _AggregateOps.measureName)(op, mname, as[i]);
92999 visitInputs(field);
93000 outputs.push(name); // Window operation
93001
93002 if ((0, _vegaUtil.hasOwnProperty)(_WindowOps.WindowOps, op)) {
93003 windows.push((0, _WindowOps.WindowOp)(op, fields[i], params[i], name));
93004 } // Aggregate operation
93005 else {
93006 if (field == null && op !== 'count') {
93007 (0, _vegaUtil.error)('Null aggregate field specified.');
93008 }
93009
93010 if (op === 'count') {
93011 counts.push(name);
93012 return;
93013 }
93014
93015 countOnly = false;
93016 let m = map[mname];
93017
93018 if (!m) {
93019 m = map[mname] = [];
93020 m.field = field;
93021 measures.push(m);
93022 }
93023
93024 m.push((0, _AggregateOps.createMeasure)(op, name));
93025 }
93026 });
93027
93028 if (counts.length || measures.length) {
93029 self.cell = cell(measures, counts, countOnly);
93030 }
93031
93032 self.inputs = Object.keys(inputs);
93033}

Callers

nothing calls this directly

Calls 3

visitInputsFunction · 0.70
cellFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected