static hasCumulativeMeasures(query) { const measures = (query.measures.concat(query.measureFilters)); const collectLeafMeasures = query.collectLeafMeasures.bind(query); return R.pipe( R.map(m => query.collectFrom([m], collectLeafMeasures, 'collectLeafMeasures')), R.unnest, R.uniq, R.map(p => query.newMeasure(p)), R.any(m => m.isCumulative()) )(measures); }
checkShouldBuildJoinForMeasureSelect(measures, keyCubeName) { return measures.map(measure => { const cubeNames = this.collectFrom([measure], this.collectCubeNamesFor.bind(this), 'collectCubeNamesFor'); if (R.any(cubeName => keyCubeName !== cubeName, cubeNames)) { const measuresJoin = this.joinGraph.buildJoin(cubeNames); if (measuresJoin.multiplicationFactor[keyCubeName]) { throw new UserError( `'${measure.measure}' references cubes that lead to row multiplication. Please rewrite it using sub query.` ); } return true; } return false; }).reduce((a, b) => a || b); }
findAutoRollupPreAggregationsForCube(cube, preAggregations) { if ( R.any(m => m.path() && m.path()[0] === cube, this.query.measures) || !this.query.measures.length && !this.query.timeDimensions.length && R.all(d => d.path() && d.path()[0] === cube, this.query.dimensions) ) { return R.pipe( R.toPairs, // eslint-disable-next-line no-unused-vars R.filter(([k, a]) => a.type === 'autoRollup'), R.map(([preAggregationName, preAggregation]) => { const cubeLattice = this.getCubeLattice(cube, preAggregationName, preAggregation); const optimalPreAggregation = cubeLattice.findOptimalPreAggregationFromLattice(this.query); return optimalPreAggregation && { preAggregationName: preAggregationName + this.autoRollupNameSuffix(cube, optimalPreAggregation), preAggregation: Object.assign( optimalPreAggregation, preAggregation ), cube, canUsePreAggregation: true, references: optimalPreAggregation }; }) )(preAggregations); } return []; }
if (!R.any((txInput) => txInput.transaction == txOutput.transaction && txInput.index == txOutput.index, txInputs)) { unspentTransactionOutput.push(txOutput);
/** * Validate AST tree content. */ let validate = data => { return new Promise((fulfill, reject) => { try { let isStylesheet = data.type === 'stylesheet', hasNoParsingErrors = 'stylesheet' in data && data.stylesheet.parsingErrors.length === 0, hasKeyframes = R.any((rule) => rule.type === 'keyframes', data.stylesheet.rules); if (!isStylesheet || !hasNoParsingErrors || !hasKeyframes) { if (!isStylesheet) { throw 'ast is not of type stylesheet'; } if (!hasNoParsingErrors) { R.map(err => console.log(new Error(`error: ${err}`)), data.stylesheet.parsingErrors); throw 'file has parse error'; } if (!hasKeyframes) { throw 'no keyframes rules found'; } } fulfill(data); } catch (err) { reject(err); } }); }