@@ -710,6 +710,115 @@ SELECT 1 AS revenue, cast('2024-01-01' AS timestamp) as time UNION ALL
710
710
]
711
711
});
712
712
713
+
714
+ cube('A', {
715
+ sql: \`
716
+ SELECT 1 AS a_id, 'foo' AS dim_a, 100 AS val_a UNION ALL
717
+ SELECT 2 AS a_id, 'foo' AS dim_a, 200 AS val_a UNION ALL
718
+ SELECT 3 AS a_id, 'bar' AS dim_a, 500 AS val_a
719
+ \`,
720
+ joins: {
721
+ B: {
722
+ relationship: 'hasMany',
723
+ sql: \`\${CUBE.a_id} = \${B.a_id}\`
724
+ },
725
+ C: {
726
+ relationship: 'hasMany',
727
+ sql: \`\${CUBE.a_id} = \${C.a_id}\`
728
+ },
729
+ },
730
+ measures: {
731
+ sum_a: {
732
+ type: 'sum',
733
+ sql: 'val_a'
734
+ }
735
+ },
736
+ dimensions: {
737
+ a_id: {
738
+ type: 'number',
739
+ sql: 'a_id',
740
+ primaryKey: true
741
+ },
742
+ dim_a: {
743
+ type: 'string',
744
+ sql: 'dim_a',
745
+ }
746
+ }
747
+ });
748
+ cube('B', {
749
+ sql: \`
750
+ SELECT 1 AS b_id, 1 AS a_id, 'foo' AS dim_b, 100 AS val_b UNION ALL
751
+ SELECT 2 AS b_id, 2 AS a_id, 'foo' AS dim_b, 200 AS val_b UNION ALL
752
+ SELECT 3 AS b_id, 2 AS a_id, 'bar' AS dim_b, 500 AS val_b
753
+ \`,
754
+ measures: {
755
+ sum_b: {
756
+ type: 'sum',
757
+ sql: 'val_b'
758
+ }
759
+ },
760
+ dimensions: {
761
+ b_id: {
762
+ type: 'number',
763
+ sql: 'b_id',
764
+ primaryKey: true
765
+ },
766
+ a_id: {
767
+ type: 'number',
768
+ sql: 'a_id',
769
+ },
770
+ dim_b: {
771
+ type: 'string',
772
+ sql: 'dim_b',
773
+ }
774
+ }
775
+ });
776
+ cube('C', {
777
+ sql: \`
778
+ SELECT 1 AS c_id, 2 AS a_id, 'foo' AS dim_c, 100 AS val_c UNION ALL
779
+ SELECT 2 AS c_id, 3 AS a_id, 'foo' AS dim_c, 200 AS val_c UNION ALL
780
+ SELECT 3 AS c_id, 3 AS a_id, 'bar' AS dim_c, 500 AS val_c UNION ALL
781
+ SELECT 4 AS c_id, 2 AS a_id, 'qux' AS dim_c, 7 AS val_c
782
+ \`,
783
+ measures: {
784
+ sum_c: {
785
+ type: 'sum',
786
+ sql: 'val_c'
787
+ }
788
+ },
789
+ dimensions: {
790
+ c_id: {
791
+ type: 'number',
792
+ sql: 'c_id',
793
+ primaryKey: true
794
+ },
795
+ a_id: {
796
+ type: 'number',
797
+ sql: 'a_id',
798
+ },
799
+ dim_c: {
800
+ type: 'string',
801
+ sql: 'dim_c',
802
+ }
803
+ }
804
+ });
805
+ view('ABC_view', {
806
+ cubes: [
807
+ {
808
+ join_path: 'A',
809
+ includes: ['a_id', 'dim_a', 'sum_a']
810
+ },
811
+ {
812
+ join_path: 'A.B',
813
+ includes: ['b_id', 'dim_b', 'sum_b']
814
+ },
815
+ {
816
+ join_path: 'A.C',
817
+ includes: ['c_id', 'dim_c', 'sum_c']
818
+ },
819
+ ]
820
+ });
821
+
713
822
` ) ;
714
823
715
824
it ( 'simple join' , async ( ) => {
@@ -3515,6 +3624,33 @@ SELECT 1 AS revenue, cast('2024-01-01' AS timestamp) as time UNION ALL
3515
3624
]
3516
3625
) ) ;
3517
3626
3627
+ it ( 'abc' , async ( ) => runQueryTest (
3628
+ {
3629
+ measures : [
3630
+ // 'ABC_view.sum_a',
3631
+ // 'ABC_view.sum_b',
3632
+ // 'ABC_view.sum_c',
3633
+ ] ,
3634
+ dimensions : [
3635
+ 'ABC_view.a_id' ,
3636
+ 'ABC_view.b_id' ,
3637
+ 'ABC_view.c_id' ,
3638
+ ] ,
3639
+ } ,
3640
+ [
3641
+ // {
3642
+ // distinct_users: '1',
3643
+ // internal_user: true,
3644
+ // revenue_total: '500',
3645
+ // },
3646
+ // {
3647
+ // distinct_users: '1',
3648
+ // internal_user: false,
3649
+ // revenue_total: '300',
3650
+ // },
3651
+ ]
3652
+ ) ) ;
3653
+
3518
3654
// TODO not implemented
3519
3655
// it('multi stage bucketing', async () => runQueryTest(
3520
3656
// {
0 commit comments