public class PatternBasedDiscovery extends Object implements TextRecordDiscoverer
| Modifier and Type | Field and Description |
|---|---|
static List<TypePattern> |
DEFAULT_PATTERNS
The default patterns used in discovery when none are specified, in order:
TypePattern.INT_PATTERN
TypePattern.LONG_PATTERN
TypePattern.DOUBLE_PATTERN
TypePattern.MONEY_PATTERN
TypePattern.DATE_PATTERN
TypePattern.TIME_PATTERN
TypePattern.TIMESTAMP_PATTERN
TypePattern.BOOLEAN_PATTERN
TypePattern.IP4ADDRESS_PATTERN
TypePattern.IP6ADDRESS_PATTERN
TypePattern.DURATION_PATTERN
TypePattern.PERIOD_PATTERN
|
| Constructor and Description |
|---|
PatternBasedDiscovery()
Creates a default mapping.
|
PatternBasedDiscovery(List<TypePattern> patterns)
Creates a mapping using the specified patterns.
|
| Modifier and Type | Method and Description |
|---|---|
TextRecord |
discoverForRead(List<List<String>> rows,
boolean containsHeader,
TextConversionDefaults defaults)
Constructs a schema for reading based on the given file analysis.
|
TextRecord |
generateForWrite(RecordTokenType type,
TextConversionDefaults defaults)
Constructs a schema for writing based on the given record type.
|
protected TextDataType |
mergeTypes(TextDataType l,
TextDataType r) |
protected TextDataType |
predictType(String value) |
public static List<TypePattern> DEFAULT_PATTERNS
TypePattern.INT_PATTERNTypePattern.LONG_PATTERNTypePattern.DOUBLE_PATTERNTypePattern.MONEY_PATTERNTypePattern.DATE_PATTERNTypePattern.TIME_PATTERNTypePattern.TIMESTAMP_PATTERNTypePattern.BOOLEAN_PATTERNTypePattern.IP4ADDRESS_PATTERNTypePattern.IP6ADDRESS_PATTERNTypePattern.DURATION_PATTERNTypePattern.PERIOD_PATTERNpublic PatternBasedDiscovery()
DEFAULT_PATTERNSpublic PatternBasedDiscovery(List<TypePattern> patterns)
TextTypes.STRING in most cases.
If a field value matches the default null indicator,
it is ignored for typing purposes.patterns - the patterns against which to compare
values. The list is in precedence order; the first
pattern to match determines the type.protected TextDataType predictType(String value)
protected TextDataType mergeTypes(TextDataType l, TextDataType r)
public TextRecord discoverForRead(List<List<String>> rows, boolean containsHeader, TextConversionDefaults defaults)
TextRecordDiscovererdiscoverForRead in interface TextRecordDiscovererrows - the analyzed rows from a text filecontainsHeader - indicates whether the first row of the
analyzed file is a headerdefaults - defaults for the discovered schemapublic TextRecord generateForWrite(RecordTokenType type, TextConversionDefaults defaults)
TextRecordDiscoverergenerateForWrite in interface TextRecordDiscoverertype - the record type of the datadefaults - defaults for the discovered schemaCopyright © 2020 Actian Corporation. All rights reserved.