cancel
Showing results for 
Search instead for 
Did you mean: 

Hash Partitioning

0 Kudos

I was going through the below discussion and understood that partition assignment happens using modulo function.

https://archive.sap.com/discussions/thread/3591007

I am using cds to create my entity and have the partition defined based on an integer column. But I could see the distribution of the data is not as per the above discussion. I am curious to understand the hash generation out of the integer data. Following is the cds entity and the insert statements to test the distibution.

Type KeyT {
 UniqueName: UniqueNameT;
 PartitionNumber: Integer;
 SystemId: SystemIdT;
};
Entity CompanyCodeE {
key CompanyCodeKey : KeyT;
BaseFields : BaseFieldsT;
FlexFields : FlexFieldsT;
SAP: SAPCompanyCodeT;
SAPProcurementUnitAssociation : Association[1] to          ProcurementUnitE on SAPProcurementUnitAssociation.ProcurementUnitKey.UniqueName = SAP.ProcurementUnitKey.UniqueName                    and SAPProcurementUnitAssociation.ProcurementUnitKey.PartitionNumber = SAP.ProcurementUnitKey.PartitionNumber;
}technical configuration {
 partition by hash (CompanyCodeKey.PartitionNumber) partitions 3000;
}
INSERT INTO "MDS_SCHEMA_BG_DEPLOY"."mdsHana.mdsDB.data::MDSEnterprise.CompanyCodeE"("CompanyCodeKey.UniqueName", "CompanyCodeKey.PartitionNumber", "CompanyCodeKey.SystemId") VALUES('SAT',2940,'SYS');

I have inserted 3000 rows with partition number ranging from 0-2999. I had an assumption that the data will be distributed to the partitions based on the modulo function and each partition will have 1 record. But when I inserted the data it's 0,1,2 or 3 rows in partitions. Now to correctly understand I need to know a bit on the hash function it uses.

Accepted Solutions (0)

Answers (0)