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.DATE_PATTERN
TypePattern.TIME_PATTERN
TypePattern.TIMESTAMP_PATTERN
TypePattern.BOOLEAN_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.
|
public static List<TypePattern> DEFAULT_PATTERNS
public PatternBasedDiscovery()
DEFAULT_PATTERNS
public 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.public TextRecord discoverForRead(List<List<String>> rows, boolean containsHeader, TextConversionDefaults defaults)
TextRecordDiscoverer
discoverForRead
in interface TextRecordDiscoverer
rows
- 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)
TextRecordDiscoverer
generateForWrite
in interface TextRecordDiscoverer
type
- the record type of the datadefaults
- defaults for the discovered schemaCopyright © 2016 Actian Corporation. All rights reserved.