public class ParsingOptions extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_READ_BUFFER
The default size, in bytes, for read operations
|
Constructor and Description |
---|
ParsingOptions()
Creates a collection with default settings:
All fields from the source will be read.
Malformed records will be read; unparsable fields will be
null-valued.
Buffers will use default sizings.
|
Modifier and Type | Method and Description |
---|---|
int |
getDecodeBuffer()
Gets the size of the buffer, in bytes, used to decode
character data.
|
ParseErrorAction |
getExtraFieldAction()
Gets how fields found when parsing the record,
but not declared in the schema are handled.
|
ParseErrorAction |
getFieldErrorAction()
Gets how fields which cannot be parsed are handled.
|
int |
getFieldLengthThreshold()
Gets the maximum length allowed for a field
value before it is considered an error.
|
ParseErrorAction |
getMissingFieldAction()
Gets how fields declared in the schema, but
not found when parsing the record are handled.
|
int |
getReadBuffer()
Gets the size of the I/O buffer, in bytes,
to use for reads.
|
int |
getRecordWarningThreshold()
Gets the maximum number of records allowed to
have parse warnings.
|
List<String> |
getSelectedFields()
Gets the list of record fields to parse.
|
void |
set(ParsingOptions options)
Copies the settings from the specified source.
|
void |
setDecodeBuffer(int size)
Sets the size of the buffer, in bytes, used to decode
character data.
|
void |
setExtraFieldAction(ParseErrorAction action)
Sets how to handle fields found when parsing the record,
but not declared in the schema.
|
void |
setFieldErrorAction(ParseErrorAction action)
Sets how to handle fields which cannot be parsed.
|
void |
setFieldLengthThreshold(int limit)
Configures the maximum length allowed for a field
value before it is considered an error.
|
void |
setMissingFieldAction(ParseErrorAction action)
Sets how to handle fields declared in the schema, but
not found when parsing the record.
|
void |
setParseErrorAction(ParseErrorAction action)
Sets how to handle all parsing errors.
|
void |
setReadBuffer(int size)
Sets the size of the I/O buffer, in bytes,
to use for reads.
|
void |
setRecordWarningThreshold(int limit)
Configures the maximum number of records which can have
parse warnings before failing.
|
void |
setSelectedFields(List<String> fields)
Sets the list of record fields to parse.
|
void |
setSelectedFields(String... fields)
Sets the list of record fields to parse.
|
public static final int DEFAULT_READ_BUFFER
public ParsingOptions()
public void set(ParsingOptions options)
options
- the settings to copypublic List<String> getSelectedFields()
public void setSelectedFields(List<String> fields)
fields
- the record fields to parsepublic void setSelectedFields(String... fields)
fields
- the record fields to parsepublic ParseErrorAction getMissingFieldAction()
public void setMissingFieldAction(ParseErrorAction action)
ParseErrorAction.WARN
.
This setting is advisory in that parsers can behave differently than configured. However, a parser should only behave in a stricter fashion than configured.
action
- the action to take on missing fieldspublic ParseErrorAction getExtraFieldAction()
public void setExtraFieldAction(ParseErrorAction action)
ParseErrorAction.WARN
.
This setting is advisory in that parsers can behave differently than configured. However, a parser should only behave in a stricter fashion than configured.
action
- the action to take on extra fieldspublic ParseErrorAction getFieldErrorAction()
public void setFieldErrorAction(ParseErrorAction action)
ParseErrorAction.WARN
.
This setting is advisory in that parsers can behave differently than configured. However, a parser should only behave in a stricter fashion than configured.
action
- the action to take on field errorspublic void setParseErrorAction(ParseErrorAction action)
action
- the action to take on parse errorsetMissingFieldAction(ParseErrorAction)
,
setExtraFieldAction(ParseErrorAction)
,
setFieldErrorAction(ParseErrorAction)
public int getRecordWarningThreshold()
public void setRecordWarningThreshold(int limit)
By default, this limit is 100
. Setting the
limit to 0
means there is no restriction
on the number of warnings.
This limit is applied per-split. Therefore, it is possible that a file in total may be allowed more warnings than the limit, depending on how it is split.
limit
- the number of records with warnings
allowedpublic int getFieldLengthThreshold()
public void setFieldLengthThreshold(int limit)
By default, this limit is 1M.
This setting is considered advisory; formats with fixed length fields may ignore this setting.
limit
- the maximum field value length
allowedpublic int getReadBuffer()
public void setReadBuffer(int size)
size
- the size of the read bufferpublic int getDecodeBuffer()
public void setDecodeBuffer(int size)
size
- the decoding buffer size to useCopyright © 2016 Actian Corporation. All rights reserved.