Class DetectPrimaryKeysInDataset
java.lang.Object
com.northconcepts.datapipeline.foundations.tools.DetectPrimaryKeysInDataset
Finds the fields, or smallest field combinations, whose values are unique across all records of a
RecordList.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetectPrimaryKeys(RecordList records) Returns a list with the first of the smallest field combinations whose values are unique across the records, or an empty list if there is none.detectPrimaryKeys(RecordList records, int maxKeyFieldCount, boolean stopOnFirstMatch) Returns the combinations of up tomaxKeyFieldCountfields whose values are unique across the records, smallest first and skipping supersets of keys already found; stops at the first one ifstopOnFirstMatchis true.getFieldListCandidates(List<String> fieldNames, int keyLength) Returns every combination ofkeyLengthnames fromfieldNames, keeping their order; throws ifkeyLengthis less than 1.static booleanisCandidateKey(RecordList records, String... fieldNames) Returns true if no two records have the same values for the given fields.
-
Constructor Details
-
DetectPrimaryKeysInDataset
public DetectPrimaryKeysInDataset()
-
-
Method Details
-
detectPrimaryKeys
Returns a list with the first of the smallest field combinations whose values are unique across the records, or an empty list if there is none. -
detectPrimaryKeys
public static List<FieldList> detectPrimaryKeys(RecordList records, int maxKeyFieldCount, boolean stopOnFirstMatch) Returns the combinations of up tomaxKeyFieldCountfields whose values are unique across the records, smallest first and skipping supersets of keys already found; stops at the first one ifstopOnFirstMatchis true. -
isCandidateKey
Returns true if no two records have the same values for the given fields. -
getFieldListCandidates
Returns every combination ofkeyLengthnames fromfieldNames, keeping their order; throws ifkeyLengthis less than 1.
-