@@ -101,6 +101,33 @@ const SecondsDurations = {
101101 * and {@code CompilerApi} configuration.
102102 */
103103export class BaseQuery {
104+ /** @type {import('./PreAggregations').PreAggregations } */
105+ preAggregations ;
106+
107+ /** @type {import('./BaseMeasure').BaseMeasure[] } */
108+ measures ;
109+
110+ /** @type {import('./BaseDimension').BaseDimension[] } */
111+ dimensions ;
112+
113+ /** @type {import('./BaseDimension').BaseDimension[] } */
114+ multiStageDimensions ;
115+
116+ /** @type {import('./BaseTimeDimension').BaseTimeDimension[] } */
117+ multiStageTimeDimensions ;
118+
119+ /** @type {import('./BaseSegment').BaseSegment[] } */
120+ segments ;
121+
122+ /** @type {(BaseFilter|BaseGroupFilter)[] } */
123+ filters ;
124+
125+ /** @type {(BaseFilter|BaseGroupFilter)[] } */
126+ measureFilters ;
127+
128+ /** @type {import('./BaseTimeDimension').BaseTimeDimension[] } */
129+ timeDimensions ;
130+
104131 /**
105132 * BaseQuery class constructor.
106133 * @param {Compilers|* } compilers
@@ -237,7 +264,7 @@ export class BaseQuery {
237264 rowLimit : this . options . rowLimit ,
238265 preAggregationsSchema : this . options . preAggregationsSchema ,
239266 className : this . constructor . name ,
240- externalClassName : this . options . externalQueryClass && this . options . externalQueryClass . name ,
267+ externalClassName : this . options . externalQueryClass ? .name ,
241268 preAggregationQuery : this . options . preAggregationQuery ,
242269 disableExternalPreAggregations : this . options . disableExternalPreAggregations ,
243270 useOriginalSqlPreAggregationsInPreAggregation : this . options . useOriginalSqlPreAggregationsInPreAggregation ,
@@ -258,20 +285,28 @@ export class BaseQuery {
258285 this . timezone = this . options . timezone ;
259286 this . rowLimit = this . options . rowLimit ;
260287 this . offset = this . options . offset ;
288+ /** @type {import('./PreAggregations').PreAggregations } */
261289 this . preAggregations = this . newPreAggregations ( ) ;
290+ /** @type {import('./BaseMeasure').BaseMeasure[] } */
262291 this . measures = ( this . options . measures || [ ] ) . map ( this . newMeasure . bind ( this ) ) ;
292+ /** @type {import('./BaseDimension').BaseDimension[] } */
263293 this . dimensions = ( this . options . dimensions || [ ] ) . map ( this . newDimension . bind ( this ) ) ;
294+ /** @type {import('./BaseDimension').BaseDimension[] } */
264295 this . multiStageDimensions = ( this . options . multiStageDimensions || [ ] ) . map ( this . newDimension . bind ( this ) ) ;
296+ /** @type {import('./BaseTimeDimension').BaseTimeDimension[] } */
265297 this . multiStageTimeDimensions = ( this . options . multiStageTimeDimensions || [ ] ) . map ( this . newTimeDimension . bind ( this ) ) ;
298+ /** @type {import('./BaseSegment').BaseSegment[] } */
266299 this . segments = ( this . options . segments || [ ] ) . map ( this . newSegment . bind ( this ) ) ;
267300
268301 const filters = this . extractFiltersAsTree ( this . options . filters || [ ] ) ;
269302
270303 // measure_filter (the one extracted from filters parameter on measure and
271- // used in drill downs) should go to WHERE instead of HAVING
304+ // used in drill- downs) should go to WHERE instead of HAVING
272305 /** @type {(BaseFilter|BaseGroupFilter)[] } */
273306 this . filters = filters . filter ( f => f . dimensionGroup || f . dimension || f . operator === 'measure_filter' || f . operator === 'measureFilter' ) . map ( this . initFilter . bind ( this ) ) ;
307+ /** @type {(BaseFilter|BaseGroupFilter)[] } */
274308 this . measureFilters = filters . filter ( f => ( f . measureGroup || f . measure ) && f . operator !== 'measure_filter' && f . operator !== 'measureFilter' ) . map ( this . initFilter . bind ( this ) ) ;
309+ /** @type {import('./BaseTimeDimension').BaseTimeDimension[] } */
275310 this . timeDimensions = ( this . options . timeDimensions || [ ] ) . map ( dimension => {
276311 if ( ! dimension . dimension ) {
277312 const join = this . joinGraph . buildJoin ( this . collectJoinHints ( true ) ) ;
@@ -471,10 +506,20 @@ export class BaseQuery {
471506 return res ;
472507 }
473508
509+ /**
510+ *
511+ * @param measurePath
512+ * @returns {BaseMeasure }
513+ */
474514 newMeasure ( measurePath ) {
475515 return new BaseMeasure ( this , measurePath ) ;
476516 }
477517
518+ /**
519+ *
520+ * @param dimensionPath
521+ * @returns {BaseDimension }
522+ */
478523 newDimension ( dimensionPath ) {
479524 if ( typeof dimensionPath === 'string' ) {
480525 const memberArr = dimensionPath . split ( '.' ) ;
@@ -492,6 +537,11 @@ export class BaseQuery {
492537 return new BaseDimension ( this , dimensionPath ) ;
493538 }
494539
540+ /**
541+ *
542+ * @param segmentPath
543+ * @returns {BaseSegment }
544+ */
495545 newSegment ( segmentPath ) {
496546 return new BaseSegment ( this , segmentPath ) ;
497547 }
@@ -515,6 +565,11 @@ export class BaseQuery {
515565 return new BaseFilter ( this , filter ) ;
516566 }
517567
568+ /**
569+ *
570+ * @param filter
571+ * @returns {BaseGroupFilter }
572+ */
518573 newGroupFilter ( filter ) {
519574 return new BaseGroupFilter ( filter ) ;
520575 }
@@ -527,10 +582,19 @@ export class BaseQuery {
527582 return new BaseTimeDimension ( this , timeDimension ) ;
528583 }
529584
585+ /**
586+ *
587+ * @param expressionParams
588+ * @returns {ParamAllocator }
589+ */
530590 newParamAllocator ( expressionParams ) {
531591 return new ParamAllocator ( expressionParams ) ;
532592 }
533593
594+ /**
595+ *
596+ * @returns {PreAggregations }
597+ */
534598 newPreAggregations ( ) {
535599 return new PreAggregations ( this , this . options . historyQueries || [ ] , this . options . cubeLatticeCache ) ;
536600 }
@@ -558,7 +622,7 @@ export class BaseQuery {
558622 if ( ! this . options . preAggregationQuery ) {
559623 preAggForQuery =
560624 this . preAggregations . findPreAggregationForQuery ( ) ;
561- if ( this . options . disableExternalPreAggregations && preAggForQuery && preAggForQuery . preAggregation . external ) {
625+ if ( this . options . disableExternalPreAggregations && preAggForQuery ? .preAggregation . external ) {
562626 preAggForQuery = undefined ;
563627 }
564628 }
@@ -1199,7 +1263,7 @@ export class BaseQuery {
11991263 }
12001264
12011265 fullKeyQueryAggregateMeasures ( context ) {
1202- const measureToHierarchy = this . collectRootMeasureToHieararchy ( context ) ;
1266+ const measureToHierarchy = this . collectRootMeasureToHierarchy ( context ) ;
12031267 const allMemberChildren = this . collectAllMemberChildren ( context ) ;
12041268 const memberToIsMultiStage = this . collectAllMultiStageMembers ( allMemberChildren ) ;
12051269
@@ -1859,7 +1923,7 @@ export class BaseQuery {
18591923 } ] ] ;
18601924 }
18611925
1862- collectRootMeasureToHieararchy ( context ) {
1926+ collectRootMeasureToHierarchy ( context ) {
18631927 const notAddedMeasureFilters = R . flatten ( this . measureFilters . map ( f => f . getMembers ( ) ) )
18641928 . filter ( f => R . none ( m => m . measure === f . measure , this . measures ) ) ;
18651929
@@ -2291,9 +2355,13 @@ export class BaseQuery {
22912355 }
22922356 }
22932357
2294- collectCubeNames ( excludeTimeDimensions ) {
2358+ /**
2359+ *
2360+ * @returns {Array<string> }
2361+ */
2362+ collectCubeNames ( ) {
22952363 return this . collectFromMembers (
2296- excludeTimeDimensions ,
2364+ [ ] ,
22972365 this . collectCubeNamesFor . bind ( this ) ,
22982366 'collectCubeNamesFor'
22992367 ) ;
@@ -2413,6 +2481,11 @@ export class BaseQuery {
24132481 return this . rollupGroupByClause ( dimensionNames ) ;
24142482 }
24152483
2484+ /**
2485+ * XXX: String as return value is added because of HiveQuery.getFieldIndex()
2486+ * @param id
2487+ * @returns {number|string|null }
2488+ */
24162489 getFieldIndex ( id ) {
24172490 const equalIgnoreCase = ( a , b ) => (
24182491 typeof a === 'string' && typeof b === 'string' && a . toUpperCase ( ) === b . toUpperCase ( )
@@ -2884,6 +2957,11 @@ export class BaseQuery {
28842957 ) ;
28852958 }
28862959
2960+ /**
2961+ *
2962+ * @param fn
2963+ * @returns {Array<string> }
2964+ */
28872965 collectCubeNamesFor ( fn ) {
28882966 const context = { cubeNames : [ ] } ;
28892967 this . evaluateSymbolSqlWithContext (
@@ -2903,6 +2981,11 @@ export class BaseQuery {
29032981 return context . joinHints ;
29042982 }
29052983
2984+ /**
2985+ *
2986+ * @param fn
2987+ * @returns {Array<string> }
2988+ */
29062989 collectMemberNamesFor ( fn ) {
29072990 const context = { memberNames : [ ] } ;
29082991 this . evaluateSymbolSqlWithContext (
@@ -3182,6 +3265,10 @@ export class BaseQuery {
31823265 ) ;
31833266 }
31843267
3268+ /**
3269+ * @param cubeName
3270+ * @returns Boolean
3271+ */
31853272 multipliedJoinRowResult ( cubeName ) {
31863273 // this.join not initialized on collectCubeNamesForSql
31873274 return this . join && this . join . multiplicationFactor [ cubeName ] ;
@@ -3312,6 +3399,11 @@ export class BaseQuery {
33123399 return inflection . underscore ( name ) . replace ( / \. / g, isPreAggregationName ? '_' : '__' ) ;
33133400 }
33143401
3402+ /**
3403+ *
3404+ * @param options
3405+ * @returns {BaseQuery }
3406+ */
33153407 newSubQuery ( options ) {
33163408 const QueryClass = this . constructor ;
33173409 return new QueryClass ( this . compilers , this . subQueryOptions ( options ) ) ;
@@ -3784,6 +3876,12 @@ export class BaseQuery {
37843876 } ;
37853877 }
37863878
3879+ /**
3880+ *
3881+ * @param cube
3882+ * @param preAggregation
3883+ * @returns {BaseQuery }
3884+ */
37873885 // eslint-disable-next-line consistent-return
37883886 preAggregationQueryForSqlEvaluation ( cube , preAggregation ) {
37893887 if ( preAggregation . type === 'autoRollup' ) {
0 commit comments