Class CsvObjectParserBase<TYPE,TARRAY>
java.lang.Object
com.illumon.iris.importers.csv.parsers.CsvObjectParserBase<TYPE,TARRAY>
- All Implemented Interfaces:
io.deephaven.csv.parsers.Parser<TARRAY>
- Direct Known Subclasses:
CsvDBDateTimeParser
public abstract class CsvObjectParserBase<TYPE,TARRAY> extends Object
-
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
Fields Modifier and Type Field Description protected booleanapplyTransformprotected AppendableColumnSink<TYPE,TARRAY>columnSinkprotected ImportColumnDataTransformerdataTransformerprotected io.deephaven.csv.util.MutableObject<TYPE>holderprotected static intINITIAL_TRANSFORM_BUFFER_SIZEprotected CsvParserContextparserContextprotected char[]transformBuffer -
Constructor Summary
Constructors Modifier Constructor Description protectedCsvObjectParserBase(AppendableColumnSink<TYPE,TARRAY> columnSink, CsvParserContext parserContext, String dataType, boolean failDefault)Base Array / Object Parser class that supports error count tracking. -
Method Summary
Modifier and Type Method Description protected abstract TYPEgetCurrentValue(String bufferValue)protected abstract intgetLength(TARRAY values)protected char[]getTransformData(io.deephaven.csv.parsers.IteratorHolder ih)Method to update reusable transform bufferprotected booleansuppressErrorAndUpdateWithDefault(long rowNum, boolean isNull, TARRAY values, int chunkIndex)On null or error conditions verifies if allowed error count is exhausted by considering strict and failDefault attributes.longtryParse(io.deephaven.csv.parsers.Parser.GlobalContext gctx, io.deephaven.csv.parsers.Parser.ParserContext<TARRAY> pctx, io.deephaven.csv.parsers.IteratorHolder ih, long begin, long end, boolean appending)protected abstract booleantryUpdateWithDefault(TARRAY values, int chunkIndex)Implementations should update with default value at the current position.protected abstract voidupdateCurrentValue(TARRAY values, TYPE currentValue, int chunkIndex)
-
Field Details
-
holder
-
INITIAL_TRANSFORM_BUFFER_SIZE
protected static final int INITIAL_TRANSFORM_BUFFER_SIZE- See Also:
- Constant Field Values
-
columnSink
-
dataTransformer
-
parserContext
-
applyTransform
protected final boolean applyTransform -
transformBuffer
protected char[] transformBuffer
-
-
Constructor Details
-
CsvObjectParserBase
protected CsvObjectParserBase(@NotNull AppendableColumnSink<TYPE,TARRAY> columnSink, @NotNull CsvParserContext parserContext, @NotNull String dataType, boolean failDefault)Base Array / Object 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 down and needed by all Custom ParsersdataType- Data type supported by parser to be used in log or error messagefailDefault- Whether (true) to use the default value (onEmpty) if parsing/conversion of the source value fails
-
-
Method Details
-
tryParse
public long tryParse(@NotNull io.deephaven.csv.parsers.Parser.GlobalContext gctx, @NotNull io.deephaven.csv.parsers.Parser.ParserContext<TARRAY> pctx, @NotNull io.deephaven.csv.parsers.IteratorHolder ih, long begin, long end, boolean appending) throws io.deephaven.csv.util.CsvReaderException- Throws:
io.deephaven.csv.util.CsvReaderException
-
getCurrentValue
@Nullable protected abstract TYPE getCurrentValue(@NotNull String bufferValue) throws InputMismatchException, NumberFormatException -
updateCurrentValue
-
getLength
-
getTransformData
@NotNull protected char[] getTransformData(@NotNull io.deephaven.csv.parsers.IteratorHolder ih)Method to update reusable transform buffer -
suppressErrorAndUpdateWithDefault
protected boolean suppressErrorAndUpdateWithDefault(long rowNum, boolean isNull, @NotNull TARRAY values, int chunkIndex) throws io.deephaven.csv.util.CsvReaderExceptionOn 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.
-
tryUpdateWithDefault
protected abstract boolean tryUpdateWithDefault(@NotNull TARRAY values, int chunkIndex)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
-