Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

CE_JOIN Self Join Issue

$
0
0

Hello,

 

I'm trying to accomplish a self-join in HANA with the CE functions. My table, TT_UNION, looks like

 

GROUPEMPLOYEESTARTDATE
1123452013-01-01
1123452013-02-01

 

...but with 50 million records. Each record is distinct, and my goal is to derive an ENDDATE. As an example, the ENDDATE for the first record should be 2013-01-31. My code has issues at the "self-join" step shown below in bold:

 

TT_UNION_PROJ01 = CE_PROJECTION (

          :TT_UNION,

          [GROUP, EMPLOYEE, STARTDATE AS "STARTDATE_TEMP",

               CE_CALC('IF("STARTDATE_TEMP" = DATE(''9999-12-31''), DATE(''9999-12-31''), "STARTDATE_TEMP" - 1)', DATE) AS "ENDDATE"]

          );

 

TT_UNION_ENDDATE01 = CE_JOIN (

          :TT_UNION,

          :TT_UNION_PROJ01,

          [GROUP, EMPLOYEE],

          [GROUP, EMPLOYEE, STARTDATE, STARTDATE_TEMP, ENDDATE]

          );

 

This bolded step should give a Cartesian product per GROUP and EMPLOYEE. When I count the records in TT_UNION_ENDDATE01, there are only 1.1 million records though.

 

Any ideas why I'm dropping records when I should get a Cartesian product?

 

Thanks,

 

Chandler

 


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>