Class Column
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.pipeline.dataset.Column
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,Serializable
- Direct Known Subclasses:
TreeNode
Holds the metadata and statistics for each field in a dataset.
- See Also:
-
Field Summary
Fields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddExceptionProperties(DataException exception) Adds this object's current state to aDataException.Adds the field's value (or each array element) to this column's stats, inferring string types as configured on the dataset.Adds the value to the value count and the null, blank, length, sample and unique-value stats without inferring its type.fromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).fromXmlElement(Element element) longReturns the number of array values seen, null arrays included.longReturnsgetLengthSum()divided by the value count, nulls included, rounded down (0 if there are no values).Returns a field type that can hold every value seen or null if none were seen.Returns the best fit inferred field type for the column.Returns NumberDescriptor with necessary details for BigInteger invalid input: '&' BigDecimal numbers only.longReturns the number of empty-string values; whitespace-only values are not counted as blank.Returns the most frequent field type, skipping an all-nullUNDEFINEDwhen others exist, or null if none were seen.intReturns the number of distinct field types seen.Returns the number of values seen for each field type, nulls included.intgetIndex()longReturns the number of string values equal to true, false, yes or no, ignoring case.Returns the most frequently occurring type in a column.longReturns the number of string values recognized as numbers, excluding leading-zero whole numbers such as007.longReturns the number of string values that match at least one date/time pattern.longReturns the number of string values not recognized as a boolean, number, date/time or UUID.longReturns the number of string values recognized as UUIDs and not as a number or date/time.longReturns the total string length of the non-null values.intReturns the most elements in a non-null array value or -1 if there were none.intReturns the longest string length of the non-null values or -1 if there were none.intReturns the fewest elements in a non-null array value or -1 if there were none.intReturns the shortest string length of the non-null values or -1 if there were none.getName()longReturns the number of non-null values, blank ones included.longlongReturns the number of null values seen for each field type.Returns the sign and digit counts that fit every number recognized in string values or null if there were none.Returns the first non-null value added to this column, as a string.intReturns the number of distinct temporal field types matched.Returns the number of string values that matched a pattern of each temporal field type.intReturns the number of distinct date/time patterns matched.Returns the number of string values that matched each date/time pattern.intReturns the number of distinct values seen, which are tracked only when the dataset collects unique values.Returns how often each distinct value occurred, with null keyed as"null".Returns the entries ofgetUniqueValues()sorted by count, most frequent first.longReturns the number of values seen, including nulls; array elements are counted individually.booleanisArray()Returns true if at least one array value was seen.booleanReturns true if at least one string value was true, false, yes or no.static booleanReturns true if the string is true, false, yes or no, ignoring case.static booleanReturns true if Commons LangNumberUtils.isParsableaccepts the string.booleanReturns true if at least one string value was recognized as a number.booleanReturns true if at least one string value matched a date/time pattern.booleanReturns true if at least one string value was not recognized as another type.booleanisUuid()Returns true if at least one string value was recognized as a UUID.setBigNumberDescriptor(NumberDescriptor bigNumberDescriptor) Set NumberDescriptor with necessary details for BigInteger invalid input: '&' BigDecimal numbers only.setBlankCount(long blankCount) Sets the number of empty-string values; whitespace-only values are not counted as blank.setFieldTypes(Map<FieldType, LongAdder> fieldTypes) Sets the number of values seen for each field type, nulls included.setIndex(int index) setLengthSum(long lengthSum) Sets the total string length of the non-null values.setMaximumLength(int maximumLength) Sets the longest string length of the non-null values (-1 if there were none).setMinimumLength(int minimumLength) Sets the shortest string length of the non-null values (-1 if there were none).setNullCount(long nullCount) setNullValueFieldTypes(ConcurrentSkipListMap<FieldType, LongAdder> nullValueFieldTypes) setNumberDescriptor(NumberDescriptor numberDescriptor) Sets the sign and digit counts that fit every number recognized in string values.setSampleValue(String sampleValue) Sets the sample value, normally the first non-null value added to this column, as a string.setTemporalFieldTypes(Map<FieldType, LongAdder> temporalFieldTypes) Sets the number of string values that matched a pattern of each temporal field type.setTemporalPatterns(Map<DateTimePattern, LongAdder> temporalPatterns) Sets the number of string values that matched each date/time pattern.setValueCount(long valueCount) Sets the number of values seen, including nulls; array elements are counted individually.toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.toXmlElement(Document document) Returns an element, created withdocument, describing this object; the default implementation throws aDataException.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionProperties, exception, exception, exception
-
Constructor Details
-
Column
protected Column() -
Column
-
Column
Creates a column that collects its unique values and their counts in the given map.
-
-
Method Details
-
getName
-
setName
-
getIndex
public int getIndex() -
setIndex
-
getValueCount
public long getValueCount()Returns the number of values seen, including nulls; array elements are counted individually. -
setValueCount
Sets the number of values seen, including nulls; array elements are counted individually. -
addValue
Adds the value to the value count and the null, blank, length, sample and unique-value stats without inferring its type. -
getUniqueValues
Returns how often each distinct value occurred, with null keyed as"null". Only filled when the dataset collects unique values. -
getUniqueValuesByCount
Returns the entries ofgetUniqueValues()sorted by count, most frequent first. -
getUniqueValueCount
public int getUniqueValueCount()Returns the number of distinct values seen, which are tracked only when the dataset collects unique values. -
getNullCount
public long getNullCount() -
setNullCount
-
incNullCount
-
getNonNullCount
public long getNonNullCount()Returns the number of non-null values, blank ones included. -
getNonNullNonBlankCount
public long getNonNullNonBlankCount() -
getBlankCount
public long getBlankCount()Returns the number of empty-string values; whitespace-only values are not counted as blank. -
setBlankCount
Sets the number of empty-string values; whitespace-only values are not counted as blank. -
incBlankCount
-
getInferredTextualValueCount
public long getInferredTextualValueCount()Returns the number of string values not recognized as a boolean, number, date/time or UUID. -
getInferredNumericValueCount
public long getInferredNumericValueCount()Returns the number of string values recognized as numbers, excluding leading-zero whole numbers such as007. -
getInferredTemporalValueCount
public long getInferredTemporalValueCount()Returns the number of string values that match at least one date/time pattern. -
getInferredBooleanValueCount
public long getInferredBooleanValueCount()Returns the number of string values equal to true, false, yes or no, ignoring case. -
getInferredUuidValueCount
public long getInferredUuidValueCount()Returns the number of string values recognized as UUIDs and not as a number or date/time. -
getArrayValueCount
public long getArrayValueCount()Returns the number of array values seen, null arrays included. -
getMinimumArrayElements
public int getMinimumArrayElements()Returns the fewest elements in a non-null array value or -1 if there were none. -
getMaximumArrayElements
public int getMaximumArrayElements()Returns the most elements in a non-null array value or -1 if there were none. -
isTextual
public boolean isTextual()Returns true if at least one string value was not recognized as another type. -
isNumeric
public boolean isNumeric()Returns true if at least one string value was recognized as a number. -
isTemporal
public boolean isTemporal()Returns true if at least one string value matched a date/time pattern. -
isBoolean
public boolean isBoolean()Returns true if at least one string value was true, false, yes or no. -
isUuid
public boolean isUuid()Returns true if at least one string value was recognized as a UUID. -
isArray
public boolean isArray()Returns true if at least one array value was seen. -
getInferredTypeName
-
getMinimumLength
public int getMinimumLength()Returns the shortest string length of the non-null values or -1 if there were none. -
setMinimumLength
Sets the shortest string length of the non-null values (-1 if there were none). -
getMaximumLength
public int getMaximumLength()Returns the longest string length of the non-null values or -1 if there were none. -
setMaximumLength
Sets the longest string length of the non-null values (-1 if there were none). -
getLengthSum
public long getLengthSum()Returns the total string length of the non-null values. -
setLengthSum
Sets the total string length of the non-null values. -
getAverageLength
public long getAverageLength()ReturnsgetLengthSum()divided by the value count, nulls included, rounded down (0 if there are no values). -
getFieldTypes
Returns the number of values seen for each field type, nulls included. -
getInferredFieldType
Returns the most frequently occurring type in a column.For example, if a column contains 10 integer values and 9 boolean values, the inferred field type for that column will be
FieldType.INT. -
getBestFitInferredFieldType
Returns the best fit inferred field type for the column.If there is more than one inferred type, it will return the best fit field type based on the
getBestFitFieldType()method. -
setFieldTypes
Sets the number of values seen for each field type, nulls included. -
addField
Adds the field's value (or each array element) to this column's stats, inferring string types as configured on the dataset. -
getFieldTypeCount
public int getFieldTypeCount()Returns the number of distinct field types seen. -
getFieldType
Returns the most frequent field type, skipping an all-nullUNDEFINEDwhen others exist, or null if none were seen. -
getNullValueFieldTypes
Returns the number of null values seen for each field type. -
setNullValueFieldTypes
public Column setNullValueFieldTypes(ConcurrentSkipListMap<FieldType, LongAdder> nullValueFieldTypes) -
getBestFitFieldType
Returns a field type that can hold every value seen or null if none were seen. Mixed numeric types give a wider numeric type; any other mix givesSTRING. -
getTemporalPatterns
Returns the number of string values that matched each date/time pattern. -
setTemporalPatterns
Sets the number of string values that matched each date/time pattern. -
getTemporalPatternCount
public int getTemporalPatternCount()Returns the number of distinct date/time patterns matched. -
getTemporalFieldTypes
Returns the number of string values that matched a pattern of each temporal field type. -
setTemporalFieldTypes
Sets the number of string values that matched a pattern of each temporal field type. -
getTemporalFieldTypeCount
public int getTemporalFieldTypeCount()Returns the number of distinct temporal field types matched. -
getNumberDescriptor
Returns the sign and digit counts that fit every number recognized in string values or null if there were none. -
setNumberDescriptor
Sets the sign and digit counts that fit every number recognized in string values. -
getBigNumberDescriptor
Returns NumberDescriptor with necessary details for BigInteger invalid input: '&' BigDecimal numbers only. -
setBigNumberDescriptor
Set NumberDescriptor with necessary details for BigInteger invalid input: '&' BigDecimal numbers only. -
getSampleValue
Returns the first non-null value added to this column, as a string. -
setSampleValue
Sets the sample value, normally the first non-null value added to this column, as a string. -
isNumber
Returns true if Commons LangNumberUtils.isParsableaccepts the string. Column type inference uses the pipeline's number detector instead. -
isBoolean
Returns true if the string is true, false, yes or no, ignoring case. -
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable- Overrides:
toRecordin classBean
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceRecordSerializable- Overrides:
fromRecordin classBean- Parameters:
source-- Returns:
- this instance.
-
toXmlElement
Description copied from interface:XmlSerializableReturns an element, created withdocument, describing this object; the default implementation throws aDataException. -
fromXmlElement
-
addExceptionProperties
Description copied from interface:DataExceptionContributorAdds this object's current state to aDataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.- Specified by:
addExceptionPropertiesin interfaceDataExceptionContributor- Overrides:
addExceptionPropertiesin classBean
-