Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9164

Re: What is Referential Join

$
0
0

I tried testing this a number of ways (regarding the referential join within an Attribute View), and could not validate that the referential join is meaningful within the context of an attribute view, even when executed from an analytic view.

 

If the idea is that the attribute view referential join will be a left only when a value from the right table is selected, I don't really see a scenario where this would be beneficial in an attribute view as most of the time the left table (which would hold the keys) in an attribute view will be the most granular level - ie KNVV (left) joined to KNA1 (right) N:1. The join to KNA1 in the attribute view may be avoided if no right fields are selected, but then again it may be cheaper to wrap KNA1 in an attribute view itself and join to the data foundation instead.

 

That being said, the referential join from a data foundation to an Attribute view within the Analytic View acting as a Left Outer if none of the right table fields are selected (all attribute views would be considered as a right table), is certainly of high value to eliminate unnecessary joins with the star.

 

In my testing, essentially no matter what I did, the attribute view still acted as an inner. However, the fact to attribute behaved as expected - it was a left outer when no right table fields were selected (skip to last 2 statements for that example).

 

Just wanted to share findings to further the discussion.

 

Thanks,

Justin

 

CREATE COLUMN TABLE "SYSTEM"."TEST_LEFT" ("MATNR" VARCHAR(18))

CREATE COLUMN TABLE "SYSTEM"."TEST_RIGHT" ("MATNR" VARCHAR(18),
  "MAT_TEXT" VARCHAR(20))

 

insert into "SYSTEM"."TEST_LEFT" values('12345')
insert into "SYSTEM"."TEST_LEFT" values('67891')
insert into "SYSTEM"."TEST_LEFT" values('55667')

 

insert into "SYSTEM"."TEST_RIGHT" values('12345','TEST_12345')
insert into "SYSTEM"."TEST_RIGHT" values('67891','TEST_67891')

 

CREATE Attribute view, TEST_LEFT.MATNR as key attribute, referential join 1:N
Resulting XML
<join cardinality="C1_N" joinType="referential" leftInput="#//Data Foundation/"SYSTEM".TEST_LEFT" rightInput="#//Data Foundation/"SYSTEM".TEST_RIGHT" textJoin="false">
      <leftElementName>MATNR</leftElementName>
      <rightElementName>MATNR</rightElementName>
    </join>

 

SELECT COUNT(*) FROM "_SYS_BIC"."copa-poc/AT_TEST_REFERENTIAL"
RESULT: 2

 

SELECT COUNT(MATNR) FROM "_SYS_BIC"."copa-poc/AT_TEST_REFERENTIAL"
RESULT: 2

 

SELECT MATNR FROM "_SYS_BIC"."copa-poc/AT_TEST_REFERENTIAL"
RESULT
MATNR
12345
67891

 

create column table "SYSTEM"."TEST_FACT"( "MATNR" VARCHAR (18) null,
  "SALES_VAL" DECIMAL (15,
2) not null)

 

insert into "SYSTEM"."TEST_FACT" values('12345',500.00)
insert into "SYSTEM"."TEST_FACT" values('11111',500.00)

insert into "SYSTEM"."TEST_FACT" values('67891',500.00)

insert into "SYSTEM"."TEST_FACT" values('55667', 500.00)

insert into "SYSTEM"."TEST_FACT" values('67891',500.00)

 

CREATE ANALYTIC view, AT_TEST_REFERENTIAL, TEST_FACT
  <join cardinality="CN_1" joinType="referential" leftInput="#//Logical Join/Data Foundation" rightInput="#//Logical Join/copa-poc::AT_TEST_REFERENTIAL" textJoin="false">
      <leftElementName>MATNR_1</leftElementName>
      <rightElementName>MATNR</rightElementName>
    </join>

 

SELECT COUNT(*) FROM "_SYS_BIC"."copa-poc/AN_TEST_REFERENTIAL"
RESULT: 2

 

SELECT COUNT(MATNR) FROM "_SYS_BIC"."copa-poc/AN_TEST_REFERENTIAL"
RESULT: 2

 

SELECT COUNT(MATNR) FROM "_SYS_BIC"."copa-poc/AN_TEST_REFERENTIAL"
RESULT: 4

 

SELECT COUNT(MAT_TEXT) FROM "_SYS_BIC"."copa-poc/AN_TEST_REFERENTIAL"
RESULT: 4

 

SELECT SUM(SALES_VAL) FROM "_SYS_BIC"."copa-poc/AN_TEST_REFERENTIAL"
SUM(SALES_VAL)
2,500

 

SELECT MATNR, SUM(SALES_VAL) FROM "_SYS_BIC"."copa-poc/AN_TEST_REFERENTIAL"
GROUP BY MATNR
MATNR;SUM(SALES_VAL)
12345;500
55667;500
67891;1,000


Viewing all articles
Browse latest Browse all 9164

Trending Articles