get filtersWithoutSubQueries() { if (!this.filtersWithoutSubQueriesValue) { this.filtersWithoutSubQueriesValue = this.allFilters.filter( f => this.collectFrom([f], this.collectSubQueryDimensionsFor.bind(this), 'collectSubQueryDimensionsFor').length === 0 ); } return this.filtersWithoutSubQueriesValue; }
const composeEntries = (editor, entries: Entry[]): Element[] => { return Arr.bind(Arr.groupBy(entries, isIndented), (entries) => { const groupIsIndented = Arr.head(entries).map(isIndented).getOr(false); return groupIsIndented ? indentedComposer(editor, entries) : outdentedComposer(editor, entries); }); }
constructor(props) { super(props); this.state = _.clone(ReplStatusBarStore.getStore()); this.onDownload = this.onDownload.bind(this); this.onTriggerPreferences = this.onTriggerPreferences.bind(this); this.onStoreChange = this.onStoreChange.bind(this); this.getActiveHandle = this.getActiveHandle.bind(this); }
query() { return this.joinQuery(this.join, this.collectFromMembers( false, this.collectSubQueryDimensionsFor.bind(this), 'collectSubQueryDimensionsFor' )); }
collectCubeNames(excludeTimeDimensions) { return this.collectFromMembers( excludeTimeDimensions, this.collectCubeNamesFor.bind(this), 'collectCubeNamesFor' ); }
(() => { // Temporary fix for node bug : https://github.com/nodejs/node/issues/3158 let ownPropertyNames = Object.getOwnPropertyNames.bind(Object); Object.getOwnPropertyNames = (o) => { let result = ownPropertyNames(o); let keys = Object.keys(o); let difference = _.difference(keys, result); return difference.length ? result.concat(difference) : result; }; })();
collectRootMeasureToHieararchy() { const notAddedMeasureFilters = R.flatten(this.measureFilters.map(f => f.getMembers())) .filter(f => R.none(m => m.measure === f.measure, this.measures)); return R.fromPairs(this.measures.concat(notAddedMeasureFilters).map(m => { const collectedMeasures = this.collectFrom( [m], this.collectMultipliedMeasures.bind(this), 'collectMultipliedMeasures', this.queryCache ); if (m.expressionName && !collectedMeasures.length) { throw new UserError(`Subquery dimension ${m.expressionName} should reference at least one measure`); } return [m.measure, collectedMeasures]; })); }
get subQueryDimensions() { // eslint-disable-next-line no-underscore-dangle if (!this._subQueryDimensions) { // eslint-disable-next-line no-underscore-dangle this._subQueryDimensions = this.collectFromMembers( false, this.collectSubQueryDimensionsFor.bind(this), 'collectSubQueryDimensionsFor' ); } // eslint-disable-next-line no-underscore-dangle return this._subQueryDimensions; }
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); }
keysQuery(primaryKeyDimension, filters) { const inlineWhereConditions = []; const query = this.rewriteInlineWhere(() => this.joinQuery( this.join, this.collectFrom( this.keyDimensions(primaryKeyDimension), this.collectSubQueryDimensionsFor.bind(this), 'collectSubQueryDimensionsFor' ) ), inlineWhereConditions); return `SELECT DISTINCT ${this.keysSelect(primaryKeyDimension)} FROM ${ query } ${this.baseWhere(filters.concat(inlineWhereConditions))}`; }
const parseList: Parser = (depth: number, itemSelection: Option<ItemSelection>, selectionState: Cell<boolean>, list: Element): Entry[] => { return Arr.bind(Traverse.children(list), (element) => { const parser = isList(element) ? parseList : parseItem; const newDepth = depth + 1; return parser(newDepth, itemSelection, selectionState, element); }); }
constructor(compilers, options) { this.compilers = compilers; this.cubeEvaluator = compilers.cubeEvaluator; this.joinGraph = compilers.joinGraph; this.options = options || {}; this.orderHashToString = this.orderHashToString.bind(this); this.defaultOrder = this.defaultOrder.bind(this); this.initFromOptions(); this.granularityParentHierarchyCache = {}; }
aggSelectForDimension(cube, dimension, aggFunction) { const cubeNamesForTimeDimension = this.collectFrom( [dimension], this.collectCubeNamesFor.bind(this), 'collectCubeNamesFor' ); if (cubeNamesForTimeDimension.length === 1 && cubeNamesForTimeDimension[0] === cube) { const dimensionSql = this.dimensionSql(dimension); return `select ${aggFunction}(${this.convertTz(dimensionSql)}) from ${this.cubeSql(cube)} ${this.asSyntaxTable} ${this.cubeAlias(cube)}`; } return null; }
constructor(props) { super(props); this.state = { collapse: true } this.onToggleCollapse = this.onToggleCollapse.bind(this); this.getKeysButLength = this.getKeysButLength.bind(this); this.getArrayRecords = this.getArrayRecords.bind(this); this.getType = this.getType.bind(this); this.getPrototype = this.getPrototype.bind(this); this.bindObjectToContext = this.bindObjectToContext.bind(this); }
constructor(props) { super(props); this.state = { iCollapse: true, collapse: true }; this.onToggleCollapse = this.onToggleCollapse.bind(this); this.onToggleICollapse = this.onToggleICollapse.bind(this); this.getMetaData = this.getMetaData.bind(this); this.buildMetaData = this.buildMetaData.bind(this); }