Interface CsvImportBuilder


public interface CsvImportBuilder
This interface defines the methods necessary for creating a CsvImport importer. Instances may be constructed via CsvImport.fromFiles(String, String) or CsvImport.fromStream(String, String, InputStream)
  • Method Details

    • setDestinationPartitions

      CsvImportBuilder setDestinationPartitions​(String destinationPartitions)
      Set the partition into which the data will be written.
      Parameters:
      destinationPartitions - the destination partition.
      Returns:
      this CsvImportBuilder
    • setDestinationPartitions

      CsvImportBuilder setDestinationPartitions​(String[] destinationPartitions)
      Set the partition into which the data will be written, as a set of path components.
      Parameters:
      destinationPartitions - the destination partition.
      Returns:
      this CsvImportBuilder
    • setDestinationDirectory

      CsvImportBuilder setDestinationDirectory​(File destinationDirectory)
      Set the destination directory to import the table to.
      Parameters:
      destinationDirectory - the destination directory
      Returns:
      this CsvImportBuilder
    • setOutputMode

      CsvImportBuilder setOutputMode​(ImportOutputMode outputMode)
      Set the mode used when writing the output file. See ImportOutputMode for details.
      Parameters:
      outputMode - the output mode to use.
      Returns:
      this CsvImportBuilder
    • setOutputMode

      CsvImportBuilder setOutputMode​(String outputMode)
      Set the mode used when writing the output file. See ImportOutputMode for details.
      Parameters:
      outputMode - the output mode to use.
      Returns:
      this CsvImportBuilder
    • setPartitionColumn

      CsvImportBuilder setPartitionColumn​(String partitionColumn)
      Set the column to use to determine the partition.
      Parameters:
      partitionColumn - the name of the partitioning column
      Returns:
      this CsvImportBuilder
    • setStrict

      CsvImportBuilder setStrict​(boolean strict)
      Parameters:
      strict -
      Returns:
      this CsvImportBuilder
    • setSourceDirectory

      CsvImportBuilder setSourceDirectory​(File sourceDirectory)
      Set the directory to search for files in. If this is not provided, the default system log path configured by deephaven properties is used.
      Parameters:
      sourceDirectory - the source directory
      Returns:
      this CsvImportBuilder
    • setSourceDirectory

      CsvImportBuilder setSourceDirectory​(String sourceDirectory)
      Set the directory to search for files in. If this is not provided, the default system log path configured by deephaven properties is used.
      Parameters:
      sourceDirectory - the source directory
      Returns:
      this CsvImportBuilder
    • setSourceFile

      CsvImportBuilder setSourceFile​(String sourceFile)
      Set the source file to load. When this value is specified the setSourceGlob(String) is ignored.
      Parameters:
      sourceFile - the path to the file to import. This should be relative to the path specified by setSourceDirectory(java.io.File).
      Returns:
      this CsvImportBuilder
    • setSourceGlob

      CsvImportBuilder setSourceGlob​(String sourceGlob)
      Set the source glob to locate files in. This value ignored when setSourceFile(String) is specified.
      Parameters:
      sourceGlob - The source file glob. This should be relative to the path specified by setSourceDirectory(java.io.File).
      Returns:
      this CsvImportBuilder
    • setSourceName

      CsvImportBuilder setSourceName​(String sourceName)
      Set the name of the ImportSource from the schema to be used during the import process.
      Parameters:
      sourceName - the name of the ImportSource
      Returns:
      this CsvImportBuilder
    • setFileFormat

      CsvImportBuilder setFileFormat​(String fileFormat)
      Set the file format of the CSV to be imported.
      Parameters:
      fileFormat - A String of:
      • DEFAULT – default format if none is specified; comma-separated field values, newline row terminators, double-quotes around field values that contain embedded commas, newline characters, or double-quotes.
      • TRIM - Similar to DEFAULT, but will trim all white space around values.
      • EXCEL – The Microsoft Excel CSV format
      • MYSQL – The MySQL CSV format
      • RFC4180 – IETF RFC 4180 MIME text/csv format
      • TDF – Tab-delimited format
      Returns:
      this builder.
    • setDelimiter

      CsvImportBuilder setDelimiter​(char delimiter)
      Set the CSV field delimiter character. Default is comma. This can be used to set a different character such as pipe (|), semi-colon (;), or any other single character.
      Parameters:
      delimiter - The char to use as a field delimiter.
      Returns:
      this builder.
    • setSkipLines

      CsvImportBuilder setSkipLines​(int skipLines)
      Sets the number of lines to be skipped at the beginning of files being read before expecting the first line of column names or data.
      Parameters:
      skipLines - An int of the number of lines to skip. Default is 0.
      Returns:
      this builder.
    • setTrim

      CsvImportBuilder setTrim​(boolean trim)
      Sets whether to trim white space around values within delimited fields.
      Parameters:
      trim - boolean true or false. Default is false.
      Returns:
      this builder.
    • setNoHeader

      CsvImportBuilder setNoHeader​(boolean noHeader)
      Indicates that the file or stream does not include a list of columns in the header. When set, a list of column names must also be provided with setColumnNames(List). Default behavior is to expect a column name list in the header.
      Parameters:
      noHeader - boolean true or false. Default is false.
      Returns:
      this builder.
    • setColumnNames

      CsvImportBuilder setColumnNames​(List<String> columnNames)
      Sets a List of column names to be used when a headerless import is run (setNoHeader(boolean)).
      Parameters:
      columnNames - A List of Strings of column names in order left to right.
      Returns:
      this builder.
    • setConstantColumnValue

      CsvImportBuilder setConstantColumnValue​(String constantColumnValue)
      Sets the value to use for source columns with a sourceType of CONSTANT.
      Parameters:
      constantColumnValue - String value for the constant column.
      Returns:
      this builder.
    • build

      CsvImport build()
      Creates a CsvImport object using the properties that have been set.
      Returns:
      A CsvImport object.