@@ -421,7 +421,7 @@ export class BaseQuery {
421421 // this.collectedJoinHints = this.collectJoinHints();
422422 const [ rootOfJoin , ...allMembersJoinHints ] = this . collectJoinHintsFromMembers ( this . allMembersConcat ( false ) ) ;
423423 const customSubQueryJoinHints = this . collectJoinHintsFromMembers ( this . joinMembersFromCustomSubQuery ( ) ) ;
424- let joinMembersJoinHints = this . collectJoinHintsFromMembers ( this . joinMembersFromJoin ( ) ) ;
424+ let joinMembersJoinHints = this . collectJoinHintsFromMembers ( this . joinMembersFromJoin ( this . join ) ) ;
425425
426426 // One cube may join the other cube via transitive joined cubes,
427427 // members from which are referenced in the join `on` clauses.
@@ -434,25 +434,23 @@ export class BaseQuery {
434434 const filteredJoinMembersJoinHints = joinMembersJoinHints . filter ( m => ! allMembersJoinHints . includes ( m ) ) ;
435435 return [
436436 ...this . queryLevelJoinHints ,
437- rootOfJoin ,
437+ ... ( rootOfJoin ? [ rootOfJoin ] : [ ] ) ,
438438 ...filteredJoinMembersJoinHints ,
439439 ...allMembersJoinHints ,
440440 ...customSubQueryJoinHints ,
441441 ] ;
442442 } ;
443443
444- const prevJoins = this . join ;
445-
444+ let prevJoins = this . join ;
446445 let newJoin = this . joinGraph . buildJoin ( constructJP ( ) ) ;
447- while ( newJoin ?. joins . length > 0 && ! R . equals ( this . join , newJoin ) ) {
448- this . join = newJoin ;
449- joinMembersJoinHints = this . collectJoinHintsFromMembers ( this . joinMembersFromJoin ( ) ) ;
446+
447+ while ( newJoin ?. joins . length > 0 && ! R . equals ( prevJoins , newJoin ) ) {
448+ prevJoins = newJoin ;
449+ joinMembersJoinHints = this . collectJoinHintsFromMembers ( this . joinMembersFromJoin ( newJoin ) ) ;
450450 newJoin = this . joinGraph . buildJoin ( constructJP ( ) ) ;
451451 }
452452
453- this . collectedJoinHints = constructJP ( ) ;
454-
455- this . join = prevJoins ;
453+ this . collectedJoinHints = R . uniq ( constructJP ( ) ) ;
456454 }
457455 return this . collectedJoinHints ;
458456 }
@@ -2489,7 +2487,7 @@ export class BaseQuery {
24892487 collectJoinHints ( excludeTimeDimensions = false ) {
24902488 const membersToCollectFrom = [
24912489 ...this . allMembersConcat ( excludeTimeDimensions ) ,
2492- ...this . joinMembersFromJoin ( ) ,
2490+ ...this . joinMembersFromJoin ( this . join ) ,
24932491 ...this . joinMembersFromCustomSubQuery ( ) ,
24942492 ] ;
24952493
@@ -2513,8 +2511,8 @@ export class BaseQuery {
25132511 } ) ;
25142512 }
25152513
2516- joinMembersFromJoin ( ) {
2517- return this . join ? this . join . joins . map ( j => ( {
2514+ joinMembersFromJoin ( join ) {
2515+ return join ? join . joins . map ( j => ( {
25182516 getMembers : ( ) => [ {
25192517 path : ( ) => null ,
25202518 cube : ( ) => this . cubeEvaluator . cubeFromPath ( j . originalFrom ) ,
0 commit comments