File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
cubejs-schema-compiler/src/compiler Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,9 @@ components:
182182 properties :
183183 name :
184184 type : " string"
185+ aliasMember :
186+ description : " When hierarchy is defined in Cube, it keeps the original path: Cube.hierarchy"
187+ type : " string"
185188 title :
186189 type : " string"
187190 levels :
Original file line number Diff line number Diff line change @@ -308,6 +308,7 @@ export class CubeEvaluator extends CubeSymbols {
308308 if ( cube . isView && ( cube . includedMembers || [ ] ) . length ) {
309309 const includedMemberPaths : string [ ] = R . uniq ( cube . includedMembers . map ( it => it . memberPath ) ) ;
310310 const includedCubeNames : string [ ] = R . uniq ( includedMemberPaths . map ( it => it . split ( '.' ) [ 0 ] ) ) ;
311+
311312 // Path to name (which can be prefixed or aliased) map for hierarchy
312313 const hierarchyPathToName = cube . includedMembers . filter ( it => it . type === 'hierarchies' ) . reduce ( ( acc , it ) => ( {
313314 ...acc ,
@@ -336,14 +337,18 @@ export class CubeEvaluator extends CubeSymbols {
336337 } )
337338 . filter ( Boolean ) ;
338339
339- const name = hierarchyPathToName [ [ cubeName , it . name ] . join ( '.' ) ] ;
340+ const aliasMember = [ cubeName , it . name ] . join ( '.' ) ;
341+
342+ const name = hierarchyPathToName [ aliasMember ] ;
340343 if ( ! name ) {
341344 throw new UserError ( `Hierarchy '${ it . name } ' not found in cube '${ cubeName } '` ) ;
342345 }
346+
343347 return {
344348 // Title might be overridden in the view
345349 title : cube . hierarchies ?. [ it . name ] ?. override ?. title || it . title ,
346350 ...it ,
351+ aliasMember,
347352 name,
348353 levels
349354 } ;
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ export class CubeToMetaTransformer {
109109 ) ( cube . segments || { } ) ,
110110 hierarchies : ( cube . evaluatedHierarchies || [ ] ) . map ( ( it ) => ( {
111111 ...it ,
112+ aliasMember : it . aliasMember ,
112113 public : it . public ?? true ,
113114 name : `${ cube . name } .${ it . name } ` ,
114115 } ) ) ,
You can’t perform that action at this time.
0 commit comments