Class CsvInstantParser
java.lang.Object
io.deephaven.importers.csv.parsers.CsvObjectParserBase<Instant,Instant[]>
io.deephaven.importers.csv.parsers.CsvInstantParser
- All Implemented Interfaces:
io.deephaven.csv.parsers.Parser<Instant[]>
Parser for Instant type object that supports error count tracking.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.csv.parsers.Parser
io.deephaven.csv.parsers.Parser.GlobalContext, io.deephaven.csv.parsers.Parser.ParserContext<TARRAY extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanprotected final AppendableColumnSink<Instant,Instant[]> protected final ImportColumnDataTransformerprotected static final intprotected final CsvParserContextprotected char[]Fields inherited from class io.deephaven.importers.csv.parsers.CsvObjectParserBase
holderFields inherited from interface io.deephaven.csv.parsers.Parser
CHUNK_SIZE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCsvInstantParser(@NotNull AppendableColumnSink<Instant, Instant[]> columnSink, @NotNull CsvParserContext parserContext, @Nullable Instant defaultValue, boolean failDefault, boolean hasDefault) Base Array Parser class that supports error count tracking. -
Method Summary
Modifier and TypeMethodDescriptionprotected InstantgetCurrentValue(@NotNull String bufferValue) Returns the parsed value of the current byte slice that has been passed in as a String value.protected intConvenience method that returns the length of the parameter values which is the array returned forParser.ParserContext.valueChunk()protected char @NotNull []getTransformData(@NotNull io.deephaven.importers.csv.parsers.ColumnDataIteratorHolder ih) Method to update reusable transform buffer@NotNull io.deephaven.csv.parsers.Parser.ParserContext<Instant[]>makeParserContext(@NotNull io.deephaven.csv.parsers.Parser.GlobalContext gctx, int chunkSize) protected booleansuppressErrorAndUpdateWithDefault(long rowNum, boolean isNull, Instant[] values, int chunkIndex) On null or error conditions verifies if allowed error count is exhausted by considering strict and failDefault attributes.longtryParse(@NotNull io.deephaven.csv.parsers.Parser.GlobalContext gctx, @NotNull io.deephaven.csv.parsers.Parser.ParserContext<Instant[]> pctx, @Nullable io.deephaven.csv.parsers.IteratorHolder ih, long begin, long end, boolean appending) Redirects to invoke tryParse with a ColumnDataIteratorHolder Implementation.protected booleantryUpdateWithDefault(Instant @NotNull [] values, int chunkIndex) Implementations should update with default value at the current position.protected voidupdateCurrentValue(Instant @NotNull [] values, @Nullable Instant currentValue, int chunkIndex) Convenience method that updates the values parameter which is an array with the given current value at the given chunkIndex.Methods inherited from class io.deephaven.importers.csv.parsers.CsvObjectParserBase
tryParse
-
Field Details
-
INITIAL_TRANSFORM_BUFFER_SIZE
protected static final int INITIAL_TRANSFORM_BUFFER_SIZE- See Also:
-
columnSink
-
dataTransformer
-
parserContext
-
applyTransform
protected final boolean applyTransform -
transformBuffer
protected char[] transformBuffer
-
-
Constructor Details
-
CsvInstantParser
protected CsvInstantParser(@NotNull @NotNull AppendableColumnSink<Instant, Instant[]> columnSink, @NotNull @NotNull CsvParserContext parserContext, @Nullable @Nullable Instant defaultValue, boolean failDefault, boolean hasDefault) Base Array Parser class that supports error count tracking.- Parameters:
columnSink- Appendable column sink for which the parser is usedparserContext- The context object that holds common attributes passed downdefaultValue- A default value that may be used if the source is empty or parsing failsfailDefault- Whether (true) to use the default value (onEmpty) if parsing/conversion of the source value failshasDefault- Whether default value is present
-
-
Method Details
-
makeParserContext
@NotNull public @NotNull io.deephaven.csv.parsers.Parser.ParserContext<Instant[]> makeParserContext(@NotNull @NotNull io.deephaven.csv.parsers.Parser.GlobalContext gctx, int chunkSize) -
getCurrentValue
protected Instant getCurrentValue(@NotNull @NotNull String bufferValue) throws InputMismatchException, NumberFormatException Description copied from class:CsvObjectParserBaseReturns the parsed value of the current byte slice that has been passed in as a String value.- Specified by:
getCurrentValuein classCsvObjectParserBase<Instant,Instant[]> - Parameters:
bufferValue- The current String value of the current byte slice- Returns:
- the parsed value of the current byte slice that has been passed in as a String value.
- Throws:
InputMismatchException- thrown while retrieving the valueNumberFormatException- thrown in case of Number data types when parsing fails due to number format errors.
-
updateCurrentValue
protected void updateCurrentValue(Instant @NotNull [] values, @Nullable @Nullable Instant currentValue, int chunkIndex) Description copied from class:CsvObjectParserBaseConvenience method that updates the values parameter which is an array with the given current value at the given chunkIndex.- Specified by:
updateCurrentValuein classCsvObjectParserBase<Instant,Instant[]> - Parameters:
values- the values array retrieved usingParser.ParserContext.valueChunk()currentValue- the value that should be updated in the values array at the given indexchunkIndex- the index where the currentValue needs to be updated
-
tryUpdateWithDefault
Implementations should update with default value at the current position.- Parameters:
values- The current values bufferchunkIndex- The current position to update on values buffer- Returns:
- true if successfully updated with supplied default value
-
getLength
Description copied from class:CsvObjectParserBaseConvenience method that returns the length of the parameter values which is the array returned forParser.ParserContext.valueChunk()- Specified by:
getLengthin classCsvObjectParserBase<Instant,Instant[]> - Parameters:
values- the values array retrieved usingParser.ParserContext.valueChunk()- Returns:
- the length of the array
-
getTransformData
protected char @NotNull [] getTransformData(@NotNull @NotNull io.deephaven.importers.csv.parsers.ColumnDataIteratorHolder ih) Method to update reusable transform buffer -
suppressErrorAndUpdateWithDefault
protected boolean suppressErrorAndUpdateWithDefault(long rowNum, boolean isNull, @NotNull Instant[] values, int chunkIndex) throws io.deephaven.csv.util.CsvReaderException On null or error conditions verifies if allowed error count is exhausted by considering strict and failDefault attributes. Updates with default value if applicable.- Parameters:
rowNum- The current row for entire importisNull- Indicates if this was invoked for a null value cellvalues- The current values bufferchunkIndex- The current position to update on values buffer- Returns:
- true if successfully updated with supplied default value
- Throws:
io.deephaven.csv.util.CsvReaderException- when exceeds max error count.
-
tryParse
public long tryParse(@NotNull @NotNull io.deephaven.csv.parsers.Parser.GlobalContext gctx, @NotNull @NotNull io.deephaven.csv.parsers.Parser.ParserContext<Instant[]> pctx, @Nullable @Nullable io.deephaven.csv.parsers.IteratorHolder ih, long begin, long end, boolean appending) throws io.deephaven.csv.util.CsvReaderException Redirects to invoke tryParse with a ColumnDataIteratorHolder Implementation. SeeParser.tryParse(GlobalContext, ParserContext, IteratorHolder, long, long, boolean)- Specified by:
tryParsein interfaceio.deephaven.csv.parsers.Parser<TYPE>- Throws:
io.deephaven.csv.util.CsvReaderException
-