Class CsvParserContext
java.lang.Object
com.illumon.iris.importers.csv.parsers.CsvParserContext
Context class that holds the attributes and functionality common to all custom parsers
-
Constructor Summary
ConstructorsConstructorDescriptionCsvParserContext
(com.fishlib.io.logger.Logger log, AtomicInteger errorCount, String arrayDelimiter, int maxError, boolean strict, ImportTableWriterFactory tableWriterFactory) -
Method Summary
Modifier and TypeMethodDescriptiongetComputedColumnPartitionValue
(String partitionValue) Delegates to the underlyingImportTableWriterFactory.getComputedColumnPartition(String)
method and returns the value.com.fishlib.io.logger.Logger
getLog()
int
boolean
isStrict()
boolean
Convenience method to evaluate the default value extracted from the schema for the respective columnsvoid
recordError
(String errorMessage, boolean failDefault) Adds the CsvReaderException to internal queue.
-
Constructor Details
-
CsvParserContext
public CsvParserContext(@NotNull com.fishlib.io.logger.Logger log, @NotNull AtomicInteger errorCount, @NotNull String arrayDelimiter, int maxError, boolean strict, @NotNull ImportTableWriterFactory tableWriterFactory) - Parameters:
log
- The passed-down loggerarrayDelimiter
- Delimiter used for array parsingstrict
- Whether to fail if a field fails conversionmaxError
- Maximum number of field conversion failures allowederrorCount
- Holds the current error count across all parsers being used to import csvtableWriterFactory
- This will be used to retrieve the appropriate partition value
-
-
Method Details
-
getLog
public com.fishlib.io.logger.Logger getLog() -
getErrorCount
-
getArrayDelimiter
-
getMaxError
public int getMaxError() -
isStrict
public boolean isStrict() -
getComputedColumnPartitionValue
Delegates to the underlyingImportTableWriterFactory.getComputedColumnPartition(String)
method and returns the value.- Parameters:
partitionValue
- the current partition value as read from the source file- Returns:
- the value returned from underlying
ImportTableWriterFactory.getComputedColumnPartition(String)
method - Throws:
ImportException
- if the returned value from factory call is null.
-
recordError
public void recordError(@NotNull String errorMessage, boolean failDefault) throws io.deephaven.csv.util.CsvReaderException Adds the CsvReaderException to internal queue. The first exception in queue is thrown if maxError limit is breached.- Parameters:
errorMessage
- The error message to be thrown in the exceptionfailDefault
- Whether (true) to use the default value (onEmpty) if parsing/conversion of the source value fails- Throws:
io.deephaven.csv.util.CsvReaderException
- thrown when strict flag is true and failDefault is false and there are exceptions in Import
-
isValueNullBlankOrNullString
Convenience method to evaluate the default value extracted from the schema for the respective columns- Parameters:
value
- the string value to evaluate- Returns:
- true if value equals null, blank, or matches in a case-insensitive way to the string null
-