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 boolean applyTransform  
    protected AppendableColumnSink<TYPE,​TARRAY> columnSink  
    protected ImportColumnDataTransformer dataTransformer  
    protected io.deephaven.csv.util.MutableObject<TYPE> holder  
    protected static int INITIAL_TRANSFORM_BUFFER_SIZE  
    protected CsvParserContext parserContext  
    protected char[] transformBuffer  

    Fields inherited from interface io.deephaven.csv.parsers.Parser

    CHUNK_SIZE
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected CsvObjectParserBase​(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 TYPE getCurrentValue​(String bufferValue)  
    protected abstract int getLength​(TARRAY values)  
    protected char[] getTransformData​(io.deephaven.csv.parsers.IteratorHolder ih)
    Method to update reusable transform buffer
    protected boolean suppressErrorAndUpdateWithDefault​(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.
    long tryParse​(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 boolean tryUpdateWithDefault​(TARRAY values, int chunkIndex)
    Implementations should update with default value at the current position.
    protected abstract void updateCurrentValue​(TARRAY values, TYPE currentValue, int chunkIndex)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.deephaven.csv.parsers.Parser

    makeParserContext
  • Field Details

  • 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 used
      parserContext - The context object that holds common attributes passed down and needed by all Custom Parsers
      dataType - Data type supported by parser to be used in log or error message
      failDefault - 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
      Throws:
      InputMismatchException
      NumberFormatException
    • updateCurrentValue

      protected abstract void updateCurrentValue​(@NotNull TARRAY values, @Nullable TYPE currentValue, int chunkIndex)
    • getLength

      protected abstract int getLength​(@NotNull TARRAY values)
    • 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.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 import
      isNull - Indicates if this was invoked for a null value cell
      values - The current values buffer
      chunkIndex - 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 buffer
      chunkIndex - The current position to update on values buffer
      Returns:
      true if successfully updated with supplied default value