@@ -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 }
@@ -2287,9 +2351,13 @@ export class BaseQuery {
22872351 }
22882352 }
22892353
2290- collectCubeNames ( excludeTimeDimensions ) {
2354+ /**
2355+ *
2356+ * @returns {Array<string> }
2357+ */
2358+ collectCubeNames ( ) {
22912359 return this . collectFromMembers (
2292- excludeTimeDimensions ,
2360+ [ ] ,
22932361 this . collectCubeNamesFor . bind ( this ) ,
22942362 'collectCubeNamesFor'
22952363 ) ;
@@ -2409,6 +2477,11 @@ export class BaseQuery {
24092477 return this . rollupGroupByClause ( dimensionNames ) ;
24102478 }
24112479
2480+ /**
2481+ * XXX: String as return value is added because of HiveQuery.getFieldIndex()
2482+ * @param id
2483+ * @returns {number|string|null }
2484+ */
24122485 getFieldIndex ( id ) {
24132486 const equalIgnoreCase = ( a , b ) => (
24142487 typeof a === 'string' && typeof b === 'string' && a . toUpperCase ( ) === b . toUpperCase ( )
@@ -2880,6 +2953,11 @@ export class BaseQuery {
28802953 ) ;
28812954 }
28822955
2956+ /**
2957+ *
2958+ * @param fn
2959+ * @returns {Array<string> }
2960+ */
28832961 collectCubeNamesFor ( fn ) {
28842962 const context = { cubeNames : [ ] } ;
28852963 this . evaluateSymbolSqlWithContext (
@@ -2899,6 +2977,11 @@ export class BaseQuery {
28992977 return context . joinHints ;
29002978 }
29012979
2980+ /**
2981+ *
2982+ * @param fn
2983+ * @returns {Array<string> }
2984+ */
29022985 collectMemberNamesFor ( fn ) {
29032986 const context = { memberNames : [ ] } ;
29042987 this . evaluateSymbolSqlWithContext (
@@ -3312,6 +3395,11 @@ export class BaseQuery {
33123395 return inflection . underscore ( name ) . replace ( / \. / g, isPreAggregationName ? '_' : '__' ) ;
33133396 }
33143397
3398+ /**
3399+ *
3400+ * @param options
3401+ * @returns {BaseQuery }
3402+ */
33153403 newSubQuery ( options ) {
33163404 const QueryClass = this . constructor ;
33173405 return new QueryClass ( this . compilers , this . subQueryOptions ( options ) ) ;
0 commit comments