@@ -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 ) ) ;
@@ -466,14 +501,29 @@ export class BaseQuery {
466501 return res ;
467502 }
468503
504+ /**
505+ *
506+ * @param measurePath
507+ * @returns {BaseMeasure }
508+ */
469509 newMeasure ( measurePath ) {
470510 return new BaseMeasure ( this , measurePath ) ;
471511 }
472512
513+ /**
514+ *
515+ * @param dimensionPath
516+ * @returns {BaseDimension }
517+ */
473518 newDimension ( dimensionPath ) {
474519 return new BaseDimension ( this , dimensionPath ) ;
475520 }
476521
522+ /**
523+ *
524+ * @param segmentPath
525+ * @returns {BaseSegment }
526+ */
477527 newSegment ( segmentPath ) {
478528 return new BaseSegment ( this , segmentPath ) ;
479529 }
@@ -497,6 +547,11 @@ export class BaseQuery {
497547 return new BaseFilter ( this , filter ) ;
498548 }
499549
550+ /**
551+ *
552+ * @param filter
553+ * @returns {BaseGroupFilter }
554+ */
500555 newGroupFilter ( filter ) {
501556 return new BaseGroupFilter ( filter ) ;
502557 }
@@ -509,10 +564,19 @@ export class BaseQuery {
509564 return new BaseTimeDimension ( this , timeDimension ) ;
510565 }
511566
567+ /**
568+ *
569+ * @param expressionParams
570+ * @returns {ParamAllocator }
571+ */
512572 newParamAllocator ( expressionParams ) {
513573 return new ParamAllocator ( expressionParams ) ;
514574 }
515575
576+ /**
577+ *
578+ * @returns {PreAggregations }
579+ */
516580 newPreAggregations ( ) {
517581 return new PreAggregations ( this , this . options . historyQueries || [ ] , this . options . cubeLatticeCache ) ;
518582 }
@@ -540,7 +604,7 @@ export class BaseQuery {
540604 if ( ! this . options . preAggregationQuery ) {
541605 preAggForQuery =
542606 this . preAggregations . findPreAggregationForQuery ( ) ;
543- if ( this . options . disableExternalPreAggregations && preAggForQuery && preAggForQuery . preAggregation . external ) {
607+ if ( this . options . disableExternalPreAggregations && preAggForQuery ? .preAggregation . external ) {
544608 preAggForQuery = undefined ;
545609 }
546610 }
@@ -2201,9 +2265,13 @@ export class BaseQuery {
22012265 }
22022266 }
22032267
2204- collectCubeNames ( excludeTimeDimensions ) {
2268+ /**
2269+ *
2270+ * @returns {Array<string> }
2271+ */
2272+ collectCubeNames ( ) {
22052273 return this . collectFromMembers (
2206- excludeTimeDimensions ,
2274+ [ ] ,
22072275 this . collectCubeNamesFor . bind ( this ) ,
22082276 'collectCubeNamesFor'
22092277 ) ;
@@ -2323,6 +2391,11 @@ export class BaseQuery {
23232391 return this . rollupGroupByClause ( dimensionNames ) ;
23242392 }
23252393
2394+ /**
2395+ * XXX: String as return value is added because of HiveQuery.getFieldIndex()
2396+ * @param id
2397+ * @returns {number|string|null }
2398+ */
23262399 getFieldIndex ( id ) {
23272400 const equalIgnoreCase = ( a , b ) => (
23282401 typeof a === 'string' && typeof b === 'string' && a . toUpperCase ( ) === b . toUpperCase ( )
@@ -2794,6 +2867,11 @@ export class BaseQuery {
27942867 ) ;
27952868 }
27962869
2870+ /**
2871+ *
2872+ * @param fn
2873+ * @returns {Array<string> }
2874+ */
27972875 collectCubeNamesFor ( fn ) {
27982876 const context = { cubeNames : [ ] } ;
27992877 this . evaluateSymbolSqlWithContext (
@@ -2813,6 +2891,11 @@ export class BaseQuery {
28132891 return context . joinHints ;
28142892 }
28152893
2894+ /**
2895+ *
2896+ * @param fn
2897+ * @returns {Array<string> }
2898+ */
28162899 collectMemberNamesFor ( fn ) {
28172900 const context = { memberNames : [ ] } ;
28182901 this . evaluateSymbolSqlWithContext (
@@ -3226,6 +3309,11 @@ export class BaseQuery {
32263309 return inflection . underscore ( name ) . replace ( / \. / g, isPreAggregationName ? '_' : '__' ) ;
32273310 }
32283311
3312+ /**
3313+ *
3314+ * @param options
3315+ * @returns {BaseQuery }
3316+ */
32293317 newSubQuery ( options ) {
32303318 const QueryClass = this . constructor ;
32313319 return new QueryClass ( this . compilers , this . subQueryOptions ( options ) ) ;
0 commit comments