[SUPPORT] MISSING RECORDS
I have a dataset with just two fields(a,b). And there no duplication of records in a*b, but individually fields a and b have been duplicated. I tried inserting this dataset into hudi with 'a' as RECORDKEY_FIELD_OPT_KEY and 'b' as PRECOMBINE_FIELD_OPT_KEY and without a partition.
But a small difference, I tried inserting them as two sets( assume set1-1000 records, set2-2000 records) . So when I inserted set1 I found that the record count in hudi table as 1000, which is correct. When I tried inserting the second batch, that's when I found that not all records were inserted. the total no of records was only 1043 instead of 3000.
Can anyone help me with the issue?
Hi @reenarosid
You probably want to use both fields (a,b) as key since that together forms unique key. You can configure complex key using following properties: hoodie.datasource.write.keygenerator.class=org.apache.hudi.keygen.ComplexKeyGenerator hoodie.datasource.write.recordkey.field=comma_seperated_list_of_primary_keys
Let me know if that doesnt work.
@satishkotha Thanks for your help, it worked.
Considering the above scenario, where the primary key is nothing but a combination of two fields a and b, the PRECOMBINE_FIELD_OPT_KEY is a/b, and the table has only two fields :
will I be able to update any of those records?
If all columns in the table are part of 'key', updates do not really make sense. Update usually means we want to change 'value' associated with key. You can consider deleting previous key and inserting new key combination. Is this a real scenario to have just 2 columns, both part of the key?
@satishkotha thanks again for your valuable suggestion, it makes sense. Yes, this is a real scenario.
-- not a real scenario-- @satishkotha Is there a way to add duplicate in the above scenario(a,b are record key) : eg: a,b are the record keys and i want to insert the following: insert [ a:1,b:1 a:6,b:7 a:1,b:1]
It is possible. But, there are edge cases where it may not work (depends on if keys are distributed to same file group etc). Consider adding another column, say timestamp (or version or uuid) to disambiguate if you need to store all versions.