Package com.illumon.iris.importers.util
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 Summary
Modifier and Type Method Description CsvImport
build()
Creates a CsvImport object using the properties that have been set.CsvImportBuilder
setColumnNames(List<String> columnNames)
Sets a List of column names to be used when a headerless import is run (setNoHeader(boolean)
).CsvImportBuilder
setConstantColumnValue(String constantColumnValue)
Sets the value to use for source columns with a sourceType of CONSTANT.CsvImportBuilder
setDelimiter(char delimiter)
Set the CSV field delimiter character.CsvImportBuilder
setDestinationDirectory(File destinationDirectory)
Set the destination directory to import the table to.CsvImportBuilder
setDestinationPartitions(String destinationPartitions)
Set the partition into which the data will be written.CsvImportBuilder
setDestinationPartitions(String[] destinationPartitions)
Set the partition into which the data will be written, as a set of path components.CsvImportBuilder
setFileFormat(String fileFormat)
Set the file format of the CSV to be imported.CsvImportBuilder
setNoHeader(boolean noHeader)
Indicates that the file or stream does not include a list of columns in the header.CsvImportBuilder
setOutputMode(ImportOutputMode outputMode)
Set the mode used when writing the output file.CsvImportBuilder
setOutputMode(String outputMode)
Set the mode used when writing the output file.CsvImportBuilder
setPartitionColumn(String partitionColumn)
Set the column to use to determine the partition.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.CsvImportBuilder
setSourceDirectory(File sourceDirectory)
Set the directory to search for files in.CsvImportBuilder
setSourceDirectory(String sourceDirectory)
Set the directory to search for files in.CsvImportBuilder
setSourceFile(String sourceFile)
Set the source file to load.CsvImportBuilder
setSourceGlob(String sourceGlob)
Set the source glob to locate files in.CsvImportBuilder
setSourceName(String sourceName)
Set the name of the ImportSource from the schema to be used during the import process.CsvImportBuilder
setStrict(boolean strict)
CsvImportBuilder
setTrim(boolean trim)
Sets whether to trim white space around values within delimited fields.
-
Method Details
-
setDestinationPartitions
Set the partition into which the data will be written.- Parameters:
destinationPartitions
- the destination partition.- Returns:
- this
CsvImportBuilder
-
setDestinationPartitions
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
Set the destination directory to import the table to.- Parameters:
destinationDirectory
- the destination directory- Returns:
- this
CsvImportBuilder
-
setOutputMode
Set the mode used when writing the output file. SeeImportOutputMode
for details.- Parameters:
outputMode
- the output mode to use.- Returns:
- this
CsvImportBuilder
-
setOutputMode
Set the mode used when writing the output file. SeeImportOutputMode
for details.- Parameters:
outputMode
- the output mode to use.- Returns:
- this
CsvImportBuilder
-
setPartitionColumn
Set the column to use to determine the partition.- Parameters:
partitionColumn
- the name of the partitioning column- Returns:
- this
CsvImportBuilder
-
setStrict
- Parameters:
strict
-- Returns:
- this
CsvImportBuilder
-
setSourceDirectory
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
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
Set the source file to load. When this value is specified thesetSourceGlob(String)
is ignored.- Parameters:
sourceFile
- the path to the file to import. This should be relative to the path specified bysetSourceDirectory(java.io.File)
.- Returns:
- this
CsvImportBuilder
-
setSourceGlob
Set the source glob to locate files in. This value ignored whensetSourceFile(String)
is specified.- Parameters:
sourceGlob
- The source file glob. This should be relative to the path specified bysetSourceDirectory(java.io.File)
.- Returns:
- this
CsvImportBuilder
-
setSourceName
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
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
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
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
Sets whether to trim white space around values within delimited fields.- Parameters:
trim
- boolean true or false. Default is false.- Returns:
- this builder.
-
setNoHeader
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 withsetColumnNames(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
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
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.
-